0 Replies Latest reply on Mar 9, 2009 4:30 AM by sebekk23

    PickList from 2 ExtendedDataTables. Problem.

    sebekk23

      Hi,
      I have problem with two extendedDataTables on same page. My extendedDataTables act like one pickList, but i have problems with rendering.
      First code:

      <h:panelGrid columns="2" width="100%" columnClasses="pickListOneCss,pickListTwoCss">
       <h:panelGroup style="width: 200px;">
       <a4j:form id="pickListOneForm" >
       <h:panelGrid columns="2" width="100%">
       <rich:extendedDataTable value="#{institutionBackingBean.pickListOne}" var="institutionPickListOne" sortMode="single"
       selectionMode="multi" width="100%" selection="#{institutionBackingBean.pickListOneSelection}" id="pickListOne">
       <!-- lista instytucji -->
       <rich:column sortable="true" sortBy="#{institutionPickListOne.institutionName}" label="Nazwa">
       <f:facet name="header">
       <h:outputText value="Nazwa podmiotu"/>
       </f:facet>
       <h:outputText value="#{institutionPickListOne.institutionName}"/>
       </rich:column>
       <rich:column sortable="true" sortBy="#{institutionPickListOne.institutionRegonPesel}"
       label="RegonPesel">
       <f:facet name="header">
       <h:outputText value="Regon/Pesel"/>
       </f:facet>
       <h:outputText value="#{institutionPickListOne.institutionRegonPesel}"/>
       </rich:column>
       </rich:extendedDataTable>
       <a4j:commandButton value="On right" reRender="pickListOne, pickListTwo"
       actionListener="#{institutionBackingBean.moveInstitutionFromPickListOneToPickListTwo}"
       />
       </h:panelGrid>
       </a4j:form>
       </h:panelGroup>
       <h:panelGroup style="width: 200px;">
       <a4j:form id="pickListTwoForm" >
       <h:panelGrid columns="2" width="100%">
       <a4j:commandButton value="On left"
       actionListener="#{institutionBackingBean.moveInstitutionFromPickListTwoToPickListOne}"
       reRender="pickListOne, pickListTwo" />
       <rich:extendedDataTable value="#{institutionBackingBean.pickListTwo}" var="institutionPickListTwo" sortMode="single"
       selectionMode="multi" width="100%" id="pickListTwo" selection="#{institutionBackingBean.pickListTwoSelection}">
       <!-- lista instytucji -->
       <rich:column sortable="true" sortBy="#{institutionPickListTwo.institutionName}" label="Nazwa">
       <f:facet name="header">
       <h:outputText value="Nazwa podmiotu"/>
       </f:facet>
       <h:outputText value="#{institutionPickListTwo.institutionName}"/>
       </rich:column>
       <rich:column sortable="true" sortBy="#{institutionPickListTwo.institutionRegonPesel}" label="RegonPesel">
       <f:facet name="header">
       <h:outputText value="Regon/Pesel"/>
       </f:facet>
       <h:outputText value="#{institutionPickListTwo.institutionRegonPesel}"/>
       </rich:column>
       </rich:extendedDataTable>
       </h:panelGrid>
       </a4j:form>
       </h:panelGroup>
      </h:panelGrid>
      

      When i move one (or some) value(s) from pickListOne to pickListTwo (and VICE VERSA) action listeners fire up and do their work, components start reRendering but when ajax request are finish only one pickList is reRender, second (this one from i take some values) still rerendering. Everything back to normal only when i force empty ajax request (request that do nothing). My actionListeners looks allmost the same:
       public void moveInstitutionFromPickListOneToPickListTwo(ActionEvent e)
       {
       HtmlExtendedDataTable table = (HtmlExtendedDataTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("institutionListFaceInclude:pickListOneForm:pickListOne");
       Object state = table.saveState(FacesContext.getCurrentInstance());
       Iterator<Object> iterator = this.getPickListOneSelection().getKeys();
       while (iterator.hasNext())
       {
       table.setRowKey((Integer) iterator.next());
       if(table.isRowAvailable())
       {
       this.getPickListTwo().add((PickListValues)table.getRowData());
       this.getPickListOne().remove((PickListValues)table.getRowData());
      
       }
       }
       table.restoreState(FacesContext.getCurrentInstance(), state);
       table = null;
       iterator = null;
       this.setPickListOneSelection(null);
       this.setPickListTwoSelection(null);
       }
      

      public void moveInstitutionFromPickListTwoToPickListOne(ActionEvent e) look like first one but reverse changes. What i'm doing wrong ? How can i workaround it ?
      Bellow screenshot after move one value from pickListOne to pickListTwo

      [url=http://img11.imageshack.us/my.php?image=second.png][img]http://img11.imageshack.us/img11/6500/second.th.png[/img][/url]