“update”属性可以同时更新两个组件吗?

2024-03-31

我有个问题。是否可以同时更新两个组件? 我正在尝试这样的代码:

<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"

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

“update”属性可以同时更新两个组件吗? 的相关文章

随机推荐