Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces Dialog Update after it is open

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 Methods.

    public boolean isSelectedFileUpload(){
    return radioValue.equals("FILE");
    } 
public boolean isSelectedUrlUpload(){
    return !isSelectedFileUpload();
    }
like image 530
Zapateus Avatar asked Mar 06 '13 10:03

Zapateus


1 Answers

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

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

like image 128
partlov Avatar answered Oct 06 '22 00:10

partlov