简体   繁体   中英

Primefaces wizard with showNavBar=“false”

I have remove primefaces Wizard default Next/Back button by adding the attribute showNavBar="false" and added my own button

<p:wizard style="border:0" showNavBar="false" widgetVar="terminationWizard">
 ........
 ........
 ........
</p:wizard>



    <div class="divTableFooter" align="right" id="footerDivfilter2" style="width: 98.00%;">
      <p:commandButton   value="Back" onclick="PF('terminationWizard').back()" />
      <p:commandButton  value="Next" onclick="PF('terminationWizard').next();" />
    </div>

Now how to Hide/show this buttons when user is first or last tab.

Using Primefaces5.3

You can add to your wizard a handling for enabling and disabling the buttons similar to

<p:wizard widgetVar"wizard"
 onback="if (PF('wizard').getStepIndex(PF('wizard').currentStep) === 1) { PF('stepBackward').disable(); } PF('stepForward').enable();"
 onnext="if (PF('wizard').getStepIndex(PF('wizard').currentStep) === 2) { PF('stepForward').disable(); } PF('stepBackward').enable();"

Where the buttons are named stepBackward and stepForward respectively and there are 4 tabs in the wizard (zero-based but the callbacks will be executed before the new tab index is set).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM