Search code examples
jsfprimefacestabview

Keep current tab when updating tabview


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?


Solution

  • 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.