Primefaces对话框打开后更新

Zap*_*eus 5 ajax dialog primefaces

我想在打开后更新内容primafaces对话框.可能吗?我的示例代码如下.

 <p:dialog widgetVar="pictureSaveDialog" id="pictureDialog" closable="false" >
   <p:outputPanel id="saveDialogPanel">

   <p:selectOneRadio id="options" value="#{pictureDefinitionsView.radioValue}"  >  
                <f:selectItem itemLabel="FILE" itemValue="FILE" />  
                <f:selectItem itemLabel=""  itemValue="URL" />  
         <p:ajax update="fileUpload1 fileUpload2" event="click" process="options"  />
   </p:selectOneRadio>

   <p:outputPanel id="fileUpload1" rendered="#{pictureDefinitionsView.selectedFileUpload}">   File </p:outputPanel>

 <p:outputPanel id="fileUpload2" rendered="#{pictureDefinitionsView.selectedUrlUpload}">   URL </p:outputPanel>
</p:outputPanel id="saveDialogPanel">
Run Code Online (Sandbox Code Playgroud)

豆方法.

    public boolean isSelectedFileUpload(){
    return radioValue.equals("FILE");
    } 
public boolean isSelectedUrlUpload(){
    return !isSelectedFileUpload();
    }
Run Code Online (Sandbox Code Playgroud)

par*_*lov 10

您可以定义p:remoteCommand哪个只是更新对话框,并在onShow属性中调用该命令:

<p:remoteCommand name="updateDialog" update="saveDialogPanel"/>

<p:dialog widgetVar="pictureSaveDialog" id="pictureDialog" closable="false" onShow="updateDialog()">
Run Code Online (Sandbox Code Playgroud)

如果您saveDialogPanel在某个命名容器中,则添加适当的前缀以匹配组件的id.