Get selected tab info from MultiViewState

UI Components for JSF
Post Reply
User avatar
undermensch
Posts: 140
Joined: 08 Jul 2010, 14:37
Location: Florida, United States

20 Jan 2022, 22:26

I have pages with dynamic tabs that load data from the backend on a tab change event...If I use MultiViewState in a tabview, how can I get the selected tab info from the MultiViewState so that I can load the data for the retained selection?
PrimeFaces-11.0.6 / Wildfly 24

User avatar
undermensch
Posts: 140
Joined: 08 Jul 2010, 14:37
Location: Florida, United States

20 Jan 2022, 23:16

Solved. I should have spent more time reading through the docs: https://primefaces.github.io/primefaces ... re/javaAPI

I just added the following line to my @PostConstruct method to get the info I needed:

Code: Select all

TabViewState tabViewState = PrimeFaces.current().multiViewState().get(FacesContext.getCurrentInstance().getViewRoot().getViewId(),"centerForm:tabs",false,TabViewState::new);
PrimeFaces-11.0.6 / Wildfly 24

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests