1 Reply Latest reply on Dec 9, 2009 2:22 PM by Ilya Shaikovsky

    Dynamically load and render modalPanel to save bandwith?

    R W Newbie

      I have several ModalPanels that are transferred to the user every time the website is loaded, without beeing invoked by the user. Now I tried to load and render these ModalPanels not until a commandLink is klicked. So far it works somehow but I want to reduce the tranferred data a little bit more.

      Here is the command button to invoke the ModalPanel:

      <a4j:commandLink id="link_object_rights"
       oncomplete="Richfaces.showModalPanel('modal_object_rights');" reRender="modal_object_rights">
       <h:graphicImage value="/img/icons/key.png" />

      Here is a part of the included Facelet of the ModalPanel:
      <rich:modalPanel id="modal_object_rights" autosized="true">
       <f:facet name="controls">
       <h:graphicImage value="/img/close.png" styleClass="hidelink" id="hidelink_object_rights" />
       <rich:componentControl for="modal_object_rights" style="cursor:pointer" attachTo="hidelink_object_rights" operation="hide" event="onclick" />
       <f:facet name="header">
       <h:outputText value="text #{moreText.text}"></h:outputText>
       <f:subview rendered="#{(identity.loggedIn) and (renderedComponents.objectRights eq true)}">

      If the subview begins before the header and the controls are defined, neither of them are shown when the ModalPanel is invoked. :(

      An optimal solution would be if the ModalPanel is rendered and afterwards shown only when a button is clicked:
      <f:subview id="modal_object_rights_subview" rendered="#{(identity.loggedIn) and (renderedComponents.objectRights eq true)}">
       <ui:include src="../modules/objectRightsModal.xhtml" />

      This way I could include all ModalPanels in my site's template without increasing the overhead and the ModalPanels would be available in the whole applicaion.

      Is there any possibility to realize something like this?