0 Replies Latest reply on Jan 14, 2008 10:46 AM by lschreiber

    selection setter does not work (ScollableDataTable)

    lschreiber

      Hello

      the example code below show how i use the scollabledatatable
      i use the SimpleSelection to take the Selection from the DataTable but when i click on the ajax button the setter (setSelection) does not work.
      Only the takeSelection Method was called.

      can anyone help me?


       <rich:panel style="padding:0" headerClass="outpanelHeader">
       <f:facet name="header">
       <h:outputText value="Vorgänge" id="paramnemsd" />
       </f:facet>
       <rich:dropSupport id="dne1t" acceptedTypes="GOBPERSON" dropValue="GOBPERSON"
       dropListener="#{backing_gobpersonsearch.processDrop}" reRender="gopselection,planneddateearch">
       </rich:dropSupport>
      
       <h:panelGrid columns="1" align="center">
       <rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="100px"
       width="700px" id="planneddateearch" rows="40" columnClasses="col" selection="#{backing_gobpersonsearch.selection}"
       value="#{backing_gobpersonsearch.searchedPlannedDates}" var="gpd">
       <rich:column id="p2d_id" >
       <f:facet name="header"><h:outputText styleClass="headerText" value="ID" /></f:facet>
       <h:outputText value="#{gpd.p2d_id}" id="a1"/>
       </rich:column>
       <rich:column id="act_name">
       <f:facet name="header"><h:outputText styleClass="headerText" value="Action" /></f:facet>
       <h:outputText value="#{gpd.act_name}" id="a2"/>
       </rich:column>
       <rich:column id="status">
       <f:facet name="header"><h:outputText styleClass="headerText" value="status" /></f:facet>
       <h:outputText value="#{gpd.status}" id="a3"/>
       </rich:column>
       <rich:column id="planned_date">
       <f:facet name="header"><h:outputText styleClass="headerText" value="Soll Datum" /></f:facet>
       <h:outputText value="#{gpd.planned_date}" id="a4"/>
       </rich:column>
       <rich:column id="next_call_date">
       <f:facet name="header"><h:outputText styleClass="headerText" value="Ist Datum" /></f:facet>
       <h:outputText value="#{gpd.next_call_date}" id="a5"/>
       </rich:column>
       </rich:scrollableDataTable>
       <a4j:commandButton value="Show Current Selection" action="#{backing_gobpersonsearch.takeSelection}"/>
       </h:panelGrid>
       </rich:panel>
      


      here is the JavaCode for setter and getter of Selection and the method takeSelection

      
       public SimpleSelection getSelection() {
       return selection;
       }
      
       public void setSelection(SimpleSelection selection) {
       System.out.println("im in Selectionsetter");
       this.selection = selection;
       }
      
      
       public String takeSelection() {
       System.out.println("im here in takeSelection");
       System.out.println(getSelection().size());
       getSelectedPlannedDate().clear();
       Iterator<SimpleRowKey> iterator = getSelection().getKeys();
      
       while (iterator.hasNext()){
       System.out.println("Selection found");
       SimpleRowKey key = iterator.next();
       }
       System.out.println(getSelectedPlannedDate().size());
       return null;
       }