0 Replies Latest reply on Jan 11, 2010 1:00 PM by csimons

    ModalPanel loading stale data; followed example but no-go

    csimons

      All,

       

      Please help if you have a moment; I have an a4j:repeat iterating through a list of objects.  Within each object, I'm also establishing a repeated dataTable.  The _responseParagraph object is clearly pulling back the right information; the goal is to load the selected/clicked object into the modal panel for editing (per RF DataTable example).


      But what's happening is that the first click works - but then that same object is loaded again and again into the modal panel no matter which object I select.  I think it's that the modal panel isn't being refreshed, even though I've wrapped it inside and outside of about 10 different a4j components to see if it would reRender appropriately.


      The crux of the issue is that the example show on the RF Components Showcase does not seem to work for me, but I can't explain why.

       

      My experience with RF is pretty high, and this is the first time I've run into this much of a roadblock in a while.

       

      Please take a look if you have a moment.

       

      The calling repeat/dataTable:

       

      <a4j:repeat id="paragraphsRepeat" var="_responseParagraph"
                         value="#{responseQueries.queryResponseParagraphsByDocument(cvResponseTemplate.responseDocument)}">

       

                      <h:form>
                          <a4j:region>
                          <rich:dataTable
                              var="_responsePosition"
                              value="#{responseQueries.queryResponsePositionsByParagraph(cvResponseTemplate.responseDocument,_responseParagraph)}"
                              rowClasses="#{dataTableBean.rowClasses}"
                              sortMode="#{dataTableBean.sortMode}"
                              width="#{dataTableBean.width}"
                              rowKeyVar="rowKey"
                              onRowMouseOver="#{dataTableBean.onRowMouseOver}"
                              onRowMouseOut="#{dataTableBean.onRowMouseOut}">
                              <f:facet name="header">
                                   <rich:columnGroup>
                                      <rich:column colspan="3">
                                          <h:outputText value="#{_responseParagraph.paraNumber} >> #{_responseParagraph.paraName} >> #{_responseParagraph.location}"/>
                                      </rich:column>
                                      <rich:column colspan="2">
                                          <div class="buttons" align="right">

       

                                               <a4j:commandLink
                                                      styleClass="add-table"
                                                      reRender="opModifyParagraph,modifyParagraphForm"
                                                      ajaxSingle="true"
                                                      oncomplete="javascript:Richfaces.showModalPanel('modifyParagraphPopup')">
                                                      <f:setPropertyActionListener value="#{_responseParagraph}"
                                                                                   target="#{responseManager.currentResponseParagraph}"/>
                                                      <ui:include src="#{formHelperBean.editBtnTemplate}">
                                                          <ui:param name="buttonText" value="Edit"/>
                                                      </ui:include>

                                              </a4j:commandLink>

       

                                          </div>
                                      </rich:column>
                                  </rich:columnGroup>

       

                              </f:facet>
                              <!-- columns removed for brevity -->
                          </rich:dataTable>
                          </a4j:region>
                          </h:form>
                         
                      </a4j:repeat>

       

      The modal panel (this is where the stale data is loaded; works the first time, but then retains this object's data in the form throughout the next calls:

       

      <rich:modalPanel id="modifyParagraphPopup" minHeight="400" minWidth="500">
          <f:facet name="header">
              <h:outputText value="Modify Paragraph" />
          </f:facet>

       

          <h:form id="modifyParagraphForm">

       

              <a4j:outputPanel id="modifyParagraphErrorPanel" ajaxRendered="true">
                      <rich:messages id="modifyParagraphErrors"
                              infoLabelClass="info-class"
                              errorLabelClass="error-class"
                              fatalLabelClass="fatal-class"
                              warnLabelClass="warn-class"></rich:messages>
              </a4j:outputPanel>
              <a4j:outputPanel ajaxRendered="true">
                      <ui:decorate template="/layout/forms/table.xhtml">
                          <tr>
                              <s:decorate id="modifyNumberDecorate" template="/layout/forms/edit.xhtml">
                                  <ui:define name="label">Paragraph Number:</ui:define>
                              <h:inputText id="modifyParaNumber"
                                           required="true"
                                           requiredMessage="Paragraph Number is required"
                                           converterMessage="Paragraph Number must be a number"
                                           validatorMessage="Paragraph Number must be a number"
                                          value="#{responseManager.currentResponseParagraph.paraNumber}"></h:inputText>
                              </s:decorate>
                          </tr>
                          <tr>
                              <s:decorate id="modifyTitleDecorate" template="/layout/forms/edit.xhtml">
                                  <ui:define name="label">Paragraph Name:</ui:define>
                              <h:inputText id="modifyParaName"
                                           required="true"
                                           requiredMessage="Paragraph Name is required"
                                          value="#{responseManager.currentResponseParagraph.paraName}"></h:inputText>
                              </s:decorate>
                          </tr>
                          <tr>
                              <s:decorate id="modifyLocationDecorate" template="/layout/forms/edit.xhtml">
                                  <ui:define name="label">Location:</ui:define>
                                  <h:inputText id="modifyParaLocation"
                                      value="#{responseManager.currentResponseParagraph.location}"></h:inputText>
                              </s:decorate>
                          </tr>
                          <tr>
                              <s:decorate id="modifyDescriptionDecorate" template="/layout/forms/simpleEdit.xhtml">
                                  <ui:define name="label">Description:</ui:define>
                                  <h:inputTextarea id="modifyParaDescription"
                                      value="#{responseManager.currentResponseParagraph.paraDescription}"
                                          rows="4"
                                          cols="40"></h:inputTextarea>
                              </s:decorate>
                          </tr>
                      </ui:decorate>

       

                      <ui:decorate template="/layout/forms/action.xhtml">

       

                          <a4j:commandLink
                              id="cmdSubmitManagedParagraph"
                              styleClass="submit"
                              data="#{facesContext.maximumSeverity.ordinal ge 2}"
                              immediate="false"
                              reRender="modifyParagraphErrorPanel,paragraphsDiv"
                              oncomplete="if(data == false) javascript:Richfaces.hideModalPanel('modifyParagraphPopup');"
                              action="#{responseManager.submitNewParagraph}" >
                              <h:graphicImage value="#{theme.imgdir}/buttons/submit.png"/>
                              <h:outputText value="#{messages['form.button.submit']}"/>
                          </a4j:commandLink>

       

                          <a4j:commandLink id="cmdCancelManagedParagraph" styleClass="cancel"
                                           immediate="true"
                                           oncomplete="javascript:Richfaces.hideModalPanel('modifyParagraphPopup')">
                                  <h:graphicImage value="#{theme.imgdir}/buttons/cancel.png"/>
                                  <h:outputText value="#{messages['form.button.cancel']}"/>
                          </a4j:commandLink>
                      </ui:decorate>
              </a4j:outputPanel>

       

          </h:form>
      </rich:modalPanel>