我在ui:repeat标签中设置了可切换面板。我有一个命令链接来显示/隐藏ui:repeat标签之外的面板。显示/隐藏功能正常。如果我打开例如3面板并隐藏面板组,一旦我显示它们,打开的面板就会崩溃。我通过bean变量控制面板折叠属性。
我的问题是如何在不折叠已打开的面板的情况下隐藏/显示面板?
我在Tomcat 7.0和JSF 2.1上使用PrimeFaces3.4.1
<h:form id="myForm">
<h:panelGroup id="panels" rendered="#{treeView.showFiltersFlag eq true}" >
<h:panelGroup id="selectedOptions">
<p:dataList value="#{treeView.selectedList}" var="value" type="ordered" rendered="#{not empty treeView.selectedList}">
#{value}
</p:dataList>
</h:panelGroup>
<ui:repeat value="#{treeView.accorObjList}" var="accorObj">
<p:panel header="#{accorObj.labelName}" toggleable="true" style="width:250px"
collapsed="#{!(accorObj.selected)}" id="panelId">
<p:ajax event="toggle" listener="#{treeView.handleToggle}" update="panelId">
</p:ajax>
<p:selectManyCheckbox layout="pageDirection" value="#{accorObj.selectedValues}"
rendered="#{(accorObj.selected) and (accorObj.type=='checkBox')}" >
<f:selectItems value="#{accorObj.values}" var="value"
itemLabel="#{value.label}" itemValue="#{value.value}"/>
<p:ajax event="change" listener="#{treeView.valueChangeListener}"/>
</p:selectManyCheckbox>
<h:panelGroup rendered="#{accorObj.type=='range'}">
<p:selectOneMenu value="#{accorObj.numericSelect}" style="width:auto">
<f:selectItem itemLabel="Choose One" itemValue="" />
<f:selectItem itemLabel="Grater than" itemValue="greater" />
<f:selectItem itemLabel="Less than" itemValue="lesser" />
<f:selectItem itemLabel="Equals" itemValue="equals" />
<f:selectItem itemLabel="Between" itemValue="between" />
<p:ajax listener="#{treeView.valueChangeListenerRange}" update="panelId"/>
</p:selectOneMenu>
</h:panelGroup>
</p:panel>
</ui:repeat>
<p:commandButton action="#{treeView.checkedItems}" value="Go" update=":myForm:selectedOptions" />
<br/><br/><br/>
<h:panelGroup style="width :100%;" rendered="#{treeView.showFiltersFlag}">
<h:panelGrid >
<p:commandLink actionListener="#{treeView.hideFilters }" style="border: 0;" update=":myForm">
<h:graphicImage library="images" name="arrow_left.gif" style="vertical-align: top; border: 0"></h:graphicImage>
</p:commandLink>
</h:panelGrid>
</h:panelGroup>
<h:panelGroup style="width :100%;" rendered="#{!treeView.showFiltersFlag}" >
<h:panelGrid styleClass="sideBar1">
<p:commandLink actionListener="#{treeView.showFilters}" style="border: 0;" update=":myForm">
<h:graphicImage library="images" name="arrow_right.png" style=" border: 0" ></h:graphicImage>
</p:commandLink>
</h:panelGrid>
</h:panelGroup>
</h:form>