how to reset primefaces wizard's steps?

<p:wizard widgetVar="wiz">
   <p:tab id="tab0">  ...  </p:tab>
   <p:tab id="tab1"> ...
      <p:commandButton value="Jump to tabId"
          actionListener="#{actionTodo.jump}"
          oncomplete="PF('wiz').loadStep('tab0', false)" />
   </p:tab>
 </p:wizard>

This works for me on PrimeFaces 5.0. Note you just need to provide the tabId to loadStep method. Also we should call PF with "PF('widgetVarId')".


org.primefaces.context.RequestContext

RequestContext context = RequestContext.getCurrentInstance();
context.reset("myForm");

I am using this javascript function and oncomplete handler on submit component:

Submit component:

oncomplete="resetWizard(args, PF('wizardWigetVar'));"

Javascript:

/**
 * Resets the wizard by loading its first step.
 * 
 * @param args
 * @param wizard
 * 
 * @returns
 */
function resetWizard(args, wizard)
{
    if (!args.validationFailed)
    {
        var firstStep = wizard.cfg.steps[0];
        if (wizard.currentStep != firstStep)
            wizard.loadStep(firstStep, true);
    }
}