2 Replies Latest reply on Aug 18, 2010 2:51 PM by zenig

    Modal InputText Resets after Poll

    zenig

      I have a page that contains a a4j:poll and a modal window.  When the a4j:poll triggers, the form in the modal window resets [back to the values in tableBean.selectedData.comments], even though that it is not part of the reRender of the a4j:poll.


      Here is the code for the a4j:poll:

      <a:region>
              <h:form style="display:inline;">
                 <a:poll id="poll" interval="60000" enabled="true" action="#{tableBean.getDataItems()}"
                      reRender="tableListForm" />
              </h:form>
      </a:region>
      

       

      Here is the code for the modal window:

      <rich:modalPanel id="editPanel" width="900" height="400">
          <f:facet name="header">
              <h:outputText value="Edit Data" />
          </f:facet>
          <f:facet name="controls">
              <h:panelGroup>
                  <h:graphicImage value="#{theme.images}/modal/close.png" id="hidelink"
                      styleClass="hidelink" />
                  <rich:componentControl for="editPanel" attachTo="hidelink"
                      operation="hide" event="onclick" />
              </h:panelGroup>
          </f:facet>
          <h:form>
              <rich:messages style="color:red;"></rich:messages>
              <h:panelGrid columns="1">
                  <a:outputPanel ajaxRendered="true">
                      <h:paelGrid columns="2">
                          <s:decorate id="commentsDecorate" template="/edit.xhtml">                    
                              <ui:define name="label">Comments:</ui:define>
                              <h:inputTextarea id="comments" rows="4" cols="30" value="#{tableBean.selectedData.comments}" required="false" />
                          </s:decorate>
                      </h:panelGrid>
                  </a:outputPanel>
                  <div>
                      <a:commandButton style="display:inline;" value="Save"
                          action="#{tableBean.save}"
                          oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.hide();"
                          reRender="tableListForm"/>&#160;
                      <a:commandButton id="cancelEditModal" style="display:inline;" value="Cancel" action="#{tableBean.cancelEdit()}"
                          oncomplete="#{rich:component('editPanel')}.hide();" />
                  </div>
              </h:panelGrid>
          </h:form>
      </rich:modalPanel>
      

       

      There is also a extendedDateTable in the mix that the a4j:poll updates.  Double clicking on a row brings up the modal window (above) for editing:

      <h:form id="tableListForm">
          <rich:extendedDataTable id="dataItems" value="#{tableBean.dataModel}" var="dataItem" rendered="#{tableBean.dataModel.rowCount>0}" width="1000px" height="500px" selection="#{tableBean.selection}" sortMode="#{tableBean.sortMode}" selectionMode="#{tableBean.selectionMode}" rows="20" tableState="#{tableBean.tableState}" eventsQueue="extendedDataTableQueue">
              <a:support event="onRowDblClick" eventsQueue="extendedDataTableQueue" reRender="editPanel" oncomplete="#{rich:component('editPanel')}.show();" />
              
           <rich:column sortable="true" sortBy="#{dataItem.comments}" filterBy="#{dataItem.comments}" filterEvent="onkeyup"
                  eventsQueue="extendedDataTableQueue" width="300px" label="Comments">
                  <f:facet id="commentFacet" name="header"><h:outputText value="Comment" /></f:facet>
                  <h:outputText value="#{dataItem.comments}" />
              </rich:column>
              <f:facet name="footer">
                  <rich:datascroller id="datascroller" eventsQueue="datascrollerQueue" ignoreDupResponce="true" renderIfSinglePage="false" />
              </f:facet>
          </rich:extendedDataTable>
        </h:form>
      

       

       

      Again, this is all on a single page.  Why would the triggering of the a4j:poll reset (or refresh) the modal window when it should only refresh the extendedDataTable?  I even tried removing the action and reRender properties of the a4j:poll and it still happens!