Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

destroy data in primefaces dialog after close from master page

in my page have some commandButton that open dialog with table . table have 300 row and after close HTML dialog not destroy and persist in HTML page . i want destroy data in dialog after hide. and after click on commandButton repeat action load dialog and load data in dialog . I found this method

<p:ajax event="close" update="growl" listener="#{dialogBean.handleClose}"/>

but not know how can destroy dialog from facescontext.

like image 841
Jeus Avatar asked Dec 15 '22 03:12

Jeus


1 Answers

Assuming you have the following dialog

<p:dialog id="dialog" widgetVar="dlgVar" dynamic="true" >
  <p:ajax event="close" update="growl" listener="#{dialogBean.handleClose}"
   onstart="PF('dlgVar').content.empty()"/>
</p:dialog>

Button

<p:commandButton value="Button" 
                 onComplete="PF('dlgVar').show()" 
                 update="dialog">

or you can call PF('dlgVar').content.empty() in the onHide of the dialog, if you don't need an ajax request.

<p:dialog id="dialog" widgetVar="dlgVar" 
          dynamic="true"
         onHide="PF('dlgVar').content.empty()">
</p:dialog>
like image 144
Hatem Alimam Avatar answered Dec 28 '22 08:12

Hatem Alimam