我有一个问题。是否可以同时更新两个组件? 我正在尝试这样的代码:
<h:panelGroup id="pickList">
<p:panel rendered="#{customCalender.visible}" widgetVar="searchTableBox">
//Some codes.....
<p:commandButton value="Cancel" update="pickList" actionListener="#{customCalender.closeList}" style="background:#25A6E1;color:red;font-family:'Helvetica Neue',sans-serif;font-size:10px;border-radius:4px;" />
<p:commandButton value="Save" update="custDataTablePanel" actionListener="#{customCalender.saveTargetList}" style="background:#25A6E1;color:red;font-family:'Helvetica Neue',sans-serif;font-size:10px;border-radius:4px;"/>
</p:panel>
</h:panelGroup>
....
.....
<h:panelGroup id="custDataTablePanel">
<p:panel rendered="#{customCalender.dataTableVisible}">
..
..
</p:panel>
</h:panelGroup>
现在我想当我点击 Save
时按钮隐藏了 <h:panelGroup id="pickList">
并显示<h:panelGroup id="custDataTablePanel">
所以我有两个 bool 值来控制它们的可见性。但我需要更新其中两个面板。我用 update="custDataTablePanel"
做的一个它在单击按钮后显示数据表。(在方法 saveTargetList
中,我将 custDataTablePanel
的可见性更新为 true。)但无法隐藏面板 pickList
.
所以我想知道是否有任何方法可以一键单击隐藏和显示这两个面板。 请提出建议。
最佳答案
您可以在 update 属性中使用多个元素,并用空格分隔
<p:commandButton update="element1 element2"/>
您还可以使用update="@form"
更新整个表单
关于jsf - 'update'属性可以同时更新两个组件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17334846/