1 Reply Latest reply on Aug 27, 2009 3:57 AM by Ilya Shaikovsky

    open modalPanel after Render Response phase

    Gina Kim Newbie

      I have a richfaces modalpanel which I want to open after an action method is called. The action method makes a connection to our database and the data I get back is used to update the model values - then the model values are used to populate the modalpanel.

      However, it looks like the modalpanel is being launched before the action method is finished because the fields in my modalpanel do not reflect what is currently in the model - it's showing what was in the model before the action mehthod was called.

      Can someone show me how I can invoke a javascript call after the "Render Response" phase in the JSF life cycle?


      When a user clicks the "Update" menuItem, the modalpanel should show:

      <rich:menuItem value="Update" id="miUpdate" submitMode="none">
      <a4j:support event="onclick" ajaxSingle="true" action="#{accountBean.setUpdatePanel}" reRender="mpUpdateForm" oncomplete="Richfaces.showModalPanel('mpUpdate')"/>
      </rich:menuItem>



      In my accountBean.setUpdatePanel method, the array accountBean.arrUpdateAttributes gets updated.

      modalPanel:
      <rich:modalPanel id="mpUpdate" autosized="true">
       <f:facet name="header">
       <h:panelGrid columns="2" width="100%">
       <h:outputText value="Update User" />
       </h:panelGrid>
       </f:facet>
       <a4j:form id="mpUpdateForm">
       <rich:scrollableDataTable id="sdtTest" height="400px" width="600px" value="#{accountBean.arrUpdateAttributes}" var="attribute">
       <rich:column id="attributeName" width="250px">
       <h:outputText value="#{attribute.name}:" />
       </rich:column>
       <rich:column id="attributeValue">
       <h:inputText value="#{attribute.value}" size="50"/> </rich:column>
       </rich:scrollableDataTable>
       </a4j:form>
       </rich:modalPanel>



      I'll really appreciate a help on this. Thanks!

        • 1. Re: open modalPanel after Render Response phase
          Ilya Shaikovsky Master

          You need to realize that modal panel can't be opened before your action called because opening modal panel - just client side operation that performed according to your code after request completelly done.

          So the problem is in your fetching data or in client side updates. Check scrollableTable example at richfaces demo, or Edit Table with modal panel example at dataTAble page of the same demo.