Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset position of p:dialog on show?

I have PrimeFaces dialog, which is centered:

<p:dialog header="Contact Information" widgetVar="companyAl"
          modal="false" position="center center">

When I open it using:

PF('companyAl').show();

it will appear on the screen center. However, when I drag it somewhere else, close it and reopen it again, it will appear again in the last position before closing instead of on the screen center. How to force it to appear always on the screen center after

PF('companyAl').show();

?

like image 478
piotrassss Avatar asked Sep 21 '16 06:09

piotrassss


1 Answers

You could also simply add an onShow attribute to the dialog:

<p:dialog header="Contact Information" widgetVar="companyAl"
          modal="false" position="center center" 
          onShow="PF('companyAl').initPosition()">
like image 101
lastresort Avatar answered Oct 16 '22 23:10

lastresort