Dialog not rendering properly based on tab selection

UI Components for JSF
Post Reply
Suganthi
Posts: 3
Joined: 22 May 2011, 05:24

01 Jun 2011, 15:09

Hi,

I've a button in a tool bar and have a tab panel below the tool bar. When i click the button, based on tab selection content of the dialog should change. Using tabChangelistener, i determine which tab is selected in the managed bean.


<p:toolbar style="width: 100%" >
<p:toolbarGroup align="right" >
<h:form>
<p:commandButton id="findBtn" value="Find" onclick="findDlg.show();" update="test:panel1, test:panel2"/>
</h:form>
</p:toolbarGroup>
</p:toolbar>

<p:dialog header="Find" widgetVar="findDlg" resizable="true"
width="500" height="300" closeOnEscape="true" closable="true" >
<h:form id="test">
<h:panelGroup id="panel1" rendered="#{findBean.tab1Active}">
<h:outputText value= "panel1 is displayed"/>
</h:panelGroup>

<h:panelGroup id="panel2" rendered="#{findBean.tab2Active}">
<h:outputText value= "panel2 is displayed"/>
</h:panelGroup>

</h:form>
</p:dialog>

<p:tabView id="tabView" tabChangeListener="#{findBean.onTabChange}" >
<p:tab title= "tabtittle1" id="id1" >
//some text box
</p:tab>

<p:tab title="tabtittle2" id="id2" >
//some output text
</p:tab>

</p:tabView>


Managed bean

public void onTabChange(TabChangeEvent event) {
activeTab = event.getTab().getId();
m_logger.info("active tab :: " + activeTab);
getActiveTab();
}

public boolean isTab1Active() {
m_logger.info("isTab1Active::" +tab1Active);
return tab1Active;
}

public boolean isTab2Active() {
m_logger.info("Tab2Active::" +tab2Active);
return tab2Active;
}



Issue : dialog is not rendering the value properly based on tab selection. Always dialog render contents, based on first tab, even if i select the second tab.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 50 guests