你如何使用?有可能吗?
这是我的示例代码。这不行。
<h:form>
<p:panel header="Panel 1" widgetVar="panel1" id="a" >
<p:commandButton onclick="panel2.show()" value="Show Panel"/>
</p:panel>
<p:panel header="Panel 2" widgetVar="panel2" id="b" visible="false">
<p:outputLabel value="asdasdasdasdsad" />
</p:panel>
</h:form>
答案 0 :(得分:0)
也许你可以在onclick动作中加入这样的东西:
<p:panel header="Panel 1" widgetVar="panel1" id="a" >
<p:commandButton onclick="document.getElementById("b").visble=true" value="Show Panel"/>
</p:panel>
<p:panel header="Panel 2" widgetVar="panel2" id="b" visible="false">
<p:outputLabel value="asdasdasdasdsad" />
</p:panel>
因此,缺陷visible = false并且onclick更改为true。
答案 1 :(得分:0)
解决!
添加toggleable =“true”closable =“true”并更新p:commandButton中的面板(update =“b”)
<p:panel header="Panel 1" widgetVar="panel1" id="a" >
<p:commandButton value="Show Panel" update="b" widgetVar="btn" onclick="panel2.show()"
>
</p:commandButton>
</p:panel>
<p:panel header="Panel 2" widgetVar="panel2" id="b" toggleable="true" closable="true" visible="false">
<p:outputLabel value="asdasdasdasdsad" />
</p:panel>