2 Replies Latest reply on Jan 24, 2011 4:09 AM by ilya40umov

    Rich:scrollableDataTable, selection not working

    anna-lenasundin

      Hi All,

      I have a rich:scrollableDataTable with two columns and I've implemented single row selection.

      That works fine as long as I click on the column showing data (h:outputText). and then on the a4j:htmlCommandLink.

      But when I click on the a4j:htmlCommandLink only, selection is not working.

      A new page showing data for choosen row is supposed to show, when clicking at the a4j:htmlCommandLink.

       

      How can I solve this?

       

      I have MyFaces 1.2.8 and RichFaces 3.3.3.

       

      Thanks in advance

       

      My jsp page:

      <rich:scrollableDataTable id="myTable"
                       width="100%" height="610px"
                       var="show" value="#{Bean.showAll}" 
                       binding = "#{Bean.table}"
                       selectionMode="single"
                       selection="#{Bean.selection}"
                       sortMode="single" >
                       <rich:column  width="300px" sortExpression="#{show.name}"  >
                           <f:facet name="header">
                               <h:outputText value="Name" />
                           </f:facet>
                           <h:outputText value="#{show.name} styleClass="xxx" />
                       </rich:column>
                      
                       <rich:column label="Show" width="100px" >
                           <a4j:htmlCommandLink ajaxSingle="true" id="editLink"
                                action="#{NavigationBean.setPage}"   >
                               <h:outputText value="Show" style="text-decoration:underline;" styleClass="xxx" />
                               <f:param name="current" value="/show.jsp" />
                           </a4j:htmlCommandLink>                 
                       </rich:column>
                                      
                       </rich:scrollableDataTable>

       

      MyBean:

      public void setSelection(SimpleSelection selection) {
               this.selection= selection;
            
               Object temp = null;
               Object row = null;
             
               Iterator<Object> iterator = getselectionAssignment().getKeys();
             
               while (iterator.hasNext()){
                    temp = iterator.next();
                   table.setRowKey(temp);
                   if(table.isRowAvailable()){
                       row =table.getRowData();
                       selectedRow = (xxx) table.getRowData();
                   }
               
               }
          }