I have a Prime Faces p:dialog
that has been resized while new components are inserted when opened ('show' state). However its position doesn't change and it's size is increasing from the down left corner until the page bottom.
I need to reposition it every time I render new components dynamically. Is there any JavaScript function I can call to its widget to reposition?
I'm using PrimeFaces 3.5 with Mojarra 2.1.13.
I had a similar situation with a TabView inside a dialog. The TabView content was dynamically loaded.
As you can see it will call the function initPosition() with every change of a Tab. This function will reposition your dialog. You can use this function in several cases.
This is a method that should work in your case :
Bean code :
View code :
A second method should also work is by JavaScript :
To add in
<h:head />
:View code :
Note : Since I'm not using PrimeFaces, I've not tested this code so I hope it work well, but the idea is here!