Charts - using dialogs and layouts

I have an application (JSF 2.0 / Primefaces 2.2RC-SNAPSHOT) that has

<p:layout> 

I use a lot of the dialog box in my application, and before the new version of the hatching came out, there was no way to display the dialog with the modal over the layout without putting dialogs outside the tags.

So I did just that. The problem I'm facing right now is to notice that when loading my application, constructors and postcontructs are called. This is due to the fact that the image with the layout is loaded, and therefore all my dialogs are loaded.

I do not want these constructors to be called until I deal with the corresponding representations in my application.

I tested the appendToBody attribute on

  <p:dialog> 

but it seems like it's really buggy. Everything works fine with the initial rendering of the view. I can open a dialog, close it, etc., and it works great. If I switch to another view, and then return to the original view and open the dialog box, everything will work from the page. The dialog box is in the right place, but the content is missing.

My question is: 1. Is there a way that I can have dialog boxes outside my layout as a child

  <h:body> 

without creating all the associated bean constructors initiated when the application loads?

Or does anyone know how to fix the alignment problem when using the appendToBody tag? Thanks.

+4
source share
2 answers

When using layout and dialog, I usually place my dialogs outside the layout as a direct child of the body. I have a special ui: insert part in my page template for this.

appendToBody has been added to make it easier, if this does not work for you, try this approach. I know that modal dialogs and layout can work this way.

+7
source

without using all the constructors associated with them, it is initiated when the application loads

Perhaps the managed application loads when you visualize your dialog.

Try to execute the dialog only after clicking the button, perhaps using rendered="#{mybean.flagLoadMyDialog}" in the dialog box and check the LoadMyDialog box when clicking the button with ajax.

Also remember the ajax-update dialog after clicking the button.

+2
source

Source: https://habr.com/ru/post/1338858/


All Articles