如何使用primefaces从commandbutton更新outputpanel,该命令按钮位于数据表中

时间:2014-02-28 10:47:03

标签: primefaces

Commandbutton with id("myButtonId2") works fine. I mean it updates "myOutputPanel" 

但是在datatable内部的commandbutton(myButtonId)不会更新outputPanel。我找到了建议并试用了以下内容,     更新= “:myForm会:myOutputPanel”     更新= “@ myForm会”     更新= “:myOutputPanel”
    但他们都没有工作......

Here is the snippet...
 <h:form id="myForm" prependId="false">
      <p:panel id="myPanel">
         <p:dataTable id="myDatatable">
            <p:column style="width:4%">  
              <p:commandButton id="myButtonId" actionListener="#{bean.showPanel}" update="myOutputPanel"/>
            </p:column>
         </p:dataTable>
         <p:commandButton id="myButtonId2" update="myOutputPanel"/>
        </p:panel>

     <p:outputPanel id="myOutputPanel" rendered="#{bean.show}">
      //some stuff
     </p:outputPanel>

1 个答案:

答案 0 :(得分:1)

尝试将<p:outputPanel />放入<p:panel />

并添加“widgetVar”属性

例如:<p:panel widgetVar="var" [..]>

并直接使用update="@widgetVar(var)"

更新面板