I have 2 tab in accordionPanel (tab1 and tab2), tab2 is disabled by default, and tab activeIndex is -1 by default.
I want the tab2 be enable if i check on the checkbox in tab1.
I tried by update the whole accordionPanel(bbb), but the tab1 will collapse as default.
method1:
xhtml:
<h:form id="aaa">
<p:accordionPanel id="bbb" activeIndex="#{beanPage.testdd}" widgetVar="accordionPanelWidget">
<p:tab id="tab1">
<f:facet name="title">
<h:panelGroup columns="2">
<h:selectBooleanCheckbox id="chkBox1" value="#{beanPage.testbb}">
<p:ajax global="false" event="click" update=":aaa:bbb:chkBox1,:aaa:bbb" listener="#{beanPage.testcc}" />
</h:selectBooleanCheckbox>
<h:outputText value="tab1" />
</h:panelGroup>
</f:facet>
<h:outputText value="tab1" />
</p:tab>
<p:tab id="tab2" disabled="#{appealPage.testaa}">
<f:facet name="title">
<h:panelGroup columns="2">
<h:selectBooleanCheckbox id="chkBox2" value="#{appealPage.testee}">
<p:ajax global="false" event="click" update=":aaa:bbb:chkBox2" />
</h:selectBooleanCheckbox>
<h:outputText value="tab2" />
</h:panelGroup>
</f:facet>
<h:outputText value="tab2" />
</p:tab>
</p:accordionPanel>
</h:form>
beanPage:
public void init() {
setTestaa(true);
setTestbb(false);
setTestee(false);
setTestdd(-1);
}
public void testcc() {
boolean result = isTestbb();
if (result) {
setTestaa(false);
} else {
setTestaa(true);
}
}