本文介绍了打开后的Primefaces对话框更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to update content primafaces dialog after it is opened. Is it possible? My example code is below.

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

Bean方法。

    public boolean isSelectedFileUpload(){
    return radioValue.equals("FILE");
    }
public boolean isSelectedUrlUpload(){
    return !isSelectedFileUpload();
    }


推荐答案

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

You can define p:remoteCommand which just update dialog, and call that command in onShow attribute:

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

<p:dialog widgetVar="pictureSaveDialog" id="pictureDialog" closable="false" onShow="updateDialog()">

如果您的 saveDialogPanel 在某些命名容器中可以添加适当的前缀以匹配组件的ID。

If your saveDialogPanel is in some naming container be shore to add appropriate prefix to match id of component.

这篇关于打开后的Primefaces对话框更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 12:52