Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 285
user2947084 Avatar asked Nov 02 '13 04:11

user2947084


People also ask

How to stay on selected tab after refresh?

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.


1 Answers

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.

like image 139
Joffrey Hernandez Avatar answered Oct 19 '22 06:10

Joffrey Hernandez