1 Reply Latest reply on May 21, 2011 9:56 AM by ilya_shaikovsky

    rich:modalpanel lazy initialization

    xmdx

      Hi guys!

      I have a page with some huge modal panels. When the page is just loaded, they aren't open, so I don't really need to render them on load, because i rerender them (with new data) anyway before make them visible.

      So guys, is it possible to make a lazy initialization(rendering) of modal panels?

       

      Now i know just one way to do it:

       

      <rich:modalPanel id="modalPanel" >

          <s:fragment rendered="#{beanForm.popUpOpen}">

           ...

           </s:fragment>

      </rich:modalPanel>

       

      and i change that boolean beanForm.popUpOpen variable to true before rerender and open modalPanel.

       

      Do you know better/more elegant method to do that? Best—with no extra-variables like popUpOpen.

       

      Thanks.

        • 1. rich:modalpanel lazy initialization
          ilya_shaikovsky

          you could apply rendered condition to the whole popup panel. In that case if have a few ones on the page you will avoid the unnesessary initialization for all of them before them really needed. (do not forget to wrap them to some wrapper component and update the wrapper before showing up in order them to be properly inserted and initialized)