PF 3.0RC1-SNAPSHOT TabView "tabChange" listener issue
Posted: 25 Nov 2011, 23:43
We have a complex PrimeFaces application with many tabs. Each tab is a separate page. And application needs to load appropriate page when some tab is selected.
To implement this we have done following:
1. Defined tab view with empty tab.
2. On tab change we check which tab is currently selected and depending on this define which
3. Updating with ajax output panel which includes some page
Value
is updated dynamically depending on what tab is selected.
This approach worked well with PrimeFaces 2.2.x. The code was following:
But this does not work anymore with PrimeFaces 3.0RC1-SNAPSHOT. I've changed the code to be
The problem is that appPreferences.getIncludePage() is called before appPreferences.onTabChange. This means that page is prepared for rendering before ajax listened is called. This makes impossible to update the page depending on the listener logic.
It looks like a defect but I wanted to hear some more thoughts on this.
Thanks,
Serhiy
To implement this we have done following:
1. Defined tab view with empty tab.
2. On tab change we check which tab is currently selected and depending on this define which
3. Updating with ajax output panel which includes some page
Code: Select all
<p:outputPanel id="mainAppFrame">
<ui:include src="#{appPreferences.includePage}"/>
</p:outputPanel>
Code: Select all
#{appPreferences.includePage}
This approach worked well with PrimeFaces 2.2.x. The code was following:
Code: Select all
<p:tabView dynamic="true" cache="false" onTabChangeUpdate="mainAppFrame" tabChangeListener="#{appPreferences.onTabChange}">
<p:tab id="someTab"/>
<p:tab id="someOtherTab"/>
</p:tabView>
<p:outputPanel id="mainAppFrame">
<ui:include src="#{appPreferences.includePage}"/>
</p:outputPanel>
But this does not work anymore with PrimeFaces 3.0RC1-SNAPSHOT. I've changed the code to be
Code: Select all
<p:tabView dynamic="true" cache="false">
<p:ajax event="tabChange" listener="#{appPreferences.onTabChange}" update="mainApplicationFrame"/>
<p:tab id="someTab"/>
<p:tab id="someOtherTab"/>
</p:tabView>
<p:outputPanel id="mainAppFrame">
<ui:include src="#{appPreferences.includePage}"/>
</p:outputPanel>
It looks like a defect but I wanted to hear some more thoughts on this.
Thanks,
Serhiy