“更新"属性可以同时更新两个组件吗? [英] Can 'update' attribute update two components simultanously?
问题描述
我有一个问题.是否可以一次更新两个组件? 我正在尝试这样的代码:
<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">
,因此我有两个布尔值来控制其可见性.但我需要更新其中两个面板.我对update="custDataTablePanel"
所做的一个操作在单击按钮后显示了数据表.(在方法saveTargetList
中,我将custDataTablePanel
的可见性更新为true.)但是无法隐藏面板pickList
.>
所以我一直在徘徊,有什么方法可以一键隐藏和显示这两个面板. 请提出建议.
您可以在update属性中使用多个元素,并以空格分隔
<p:commandButton update="element1 element2"/>
您还可以使用update="@form"
I have a question. Is that possible to update two components at a time? I am trying a code like this:
<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>
Now I want when I click on the Save
button it hides the <h:panelGroup id="pickList">
and displays the <h:panelGroup id="custDataTablePanel">
so I have two boolean values to control their visibility. but I need to update two of these panels. One I did with update="custDataTablePanel"
it displays the data table after the button click.(in the method saveTargetList
I updated the visibility of the custDataTablePanel
to true.) but cant manage to hide the panel pickList
.
So I was wandering is there any way to hide and show these two panels in one button click. Please suggest.
You can use many elements in the update attribute separated by a space
<p:commandButton update="element1 element2"/>
also you can update the whole form by using update="@form"
这篇关于“更新"属性可以同时更新两个组件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!