-
1. Re: tabPanel: selected tab is lost
awheeler Mar 26, 2007 7:52 PM (in response to aland)I have the same problem. I have tabs with dataTables, which when selected edit the item in a nested conversation. When the nested conversation "pops" the tab context is back at the first tab.
I took a slightly different approach using a backing bean. I tried using the valueChangeListener on the tabPanel but that does not give new or old values of the selected tab. Perhaps the Richfaces guys could look at implementing the listener so that the old value is the previous tab and the new value is the newly selected tab.
Anyway, I tried a backing bean which looks like:@Scope(ScopeType.CONVERSATION) @Name("richFacesTabSelection") public class RichFacesTabSelection implements IRichFacesTabSelection,Serializable { private static final long serialVersionUID = 5709694844281585638L; private String selectedTab; public void tabSelectedActionListener(ActionEvent event) { this.setSelectedTab(event.getComponent().getId()); } public String getSelectedTab() { return selectedTab; } public void setSelectedTab(String selectedTab) { this.selectedTab = selectedTab; } }
The tab looks like:<rich:tabPanel switchType="server" selectedTab="#{richFacesTabSelection.selectedTab}"> <rich:tab id="tab1" label="Testing" actionListener="#{richFacesTabSelection.tabSelectedActionListener}"> . . </rich:tabPanel>
Ideally I'd like the backing bean to be at page scope, but it does not retain its state when a nested conversation is popped. You'll probably run into trouble with this bean if there are more than one tabPanels in the same conversation. Perhaps the bean could be modified to put the selectedTab in the request values as per seam's datamodelselection.
It would be nice if this issue is resolved by the standard richfaces tabpanel. -
2. Re: tabPanel: selected tab is lost
mbolcina Mar 27, 2007 8:00 AM (in response to aland)I am having same problem. I tought that tabPanel remembers its selected tab?
-
3. Re: tabPanel: selected tab is lost
nbelaevski Mar 28, 2007 11:03 AM (in response to aland)Hello all!
I've checked tabPanelDemo application today. Both valueChange listeners work fine: one defined as component attribute, the other defined as nested tag. You can see them at action in the demo application.
The new value obtained from getNewValue() of ValueChangeEvent corresponds to concrete tab name and can then be set as "currentTab" property of tabPanel to open that concrete tab.