10 Replies Latest reply on Feb 2, 2008 4:47 PM by sergeysmirnov

    Rerender and show a modal panel after an Ajax request comple

    chawax

      Hi,

      In my application I use Richfaces with Seam. In a facelet I have a <rich:datatable> with a "detail" button for each row. This detail button calls a Seam action (which outjects a "demandeAbsence" variable into conversation scope), then rerenders a modal panel, and finally calls "Richfaces.showModalPanel" on "oncomplete" event to show the modal panel.

      The code to call Ajax is as following :

      <a4j:commandButton
       id="cmdDetail"
       value="#{messages['label.detail']}"
       action="#{listeDemandesAbsenceByDemandeurAction.detailDemandeAbsence()}"
       reRender="detailDemandeAbsence"
       oncomplete="Richfaces.showModalPanel('panelDetailDemandeAbsence')" />


      My modal panel looks like this :
      <rich:modalPanel id="panelDetailDemandeAbsence">
       <h:form>
       <h:panelGrid columns="2">
       <h:outputText value="Demandeur :" style="font-weight:bold" />
       <h:outputText value="#{demandeAbsence.matriculeDemandeur} - #{demandeAbsence.infosDemandeur}" />
       <h:outputText value="Motif :" style="font-weight:bold" />
       <h:outputText value="#{demandeAbsence.lignes[0].motif}" />
       <h:outputText value="Justification : " style="font-weight:bold" />
       <h:outputText value="#{demandeAbsence.justification}" />
       </h:panelGrid>
       <a4j:commandButton onclick="Richfaces.hideModalPanel('panelDetailDemandeAbsence')" value="Fermer" />
       </h:form>
      </rich:modalPanel>


      But nothing appears in my modal panel, while the conversation variable is OK (I saw it with debug page). I tried with a standard <rich:panel> and it works, so the problem comes from <rich:modalPanel>. In fact it looks like the oncomplete event is fired before the rerender was done, or before the variable "demandeAbsence" was outjected.

      Anyone has an idea why it does not work ?

      Thanks in advance,

      Olivier