I'm using primefaces 4.0 and have a tabview with 4 tabs. When I click a button in one of the tabs I want to update all of the tabs but keep the current tab selected. However, when I update the tabview, the selected tab keeps getting set back to the first tab.
Is there a simple way to keep the current tab when updating the entire tabview?
Answer: Use the HTML5 localStorage Object However, you can use the HTML5 localStorage object to save some parameter for the current tab locally in the browser and get it back to make the last active tab selected on page reload.
You could use activeIndex attribut from tabView :
<p:tabView activeIndex="#{bean.activeIndex}"/>
From Primeface User Guide:
activeIndex is an Integer with default value 0. Index of the active tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With