5 Replies Latest reply on Mar 9, 2012 4:28 PM by zeroshade

    UIExtendedDataTable getRowKey always null

    luedinski

      Hi folks,

       

      i started with Richfaces and JSF a few months ago and it's really fun. I always was able to find a solution for any problem, but now i'm stuck. Maybe someone has an idea on the following problem.

       

      I use some ExtendedDataTables to implement filters in a project. I use the example from the JBoss showcase. The Problem is, that in my backing bean, the getRowKey Method always returns null. Here is my code:

       

       

      <rich:extendedDataTable frozenColumns="2"
      
                                          styleClass="filterTable"
      
                                          value="#{jobspecFilterController.getBusinessList()}"
      
                                          var="business" rendered="true" selectionMode="single"
      
                                          id="bussinessTable" selection="#{jobspecFilterController.businessSelection}">
      
                                          <a4j:ajax execute="@form" event="selectionchange"
      
                                              listener="#{jobspecFilterController.selectionListener}"
      
                                              render="secondTable"/>
      
                                          <f:facet name="header">
      
                                              <h:outputText value="Business" />
      
                                          </f:facet>
      
                                          <rich:column width="30px">
      
                                              <f:facet name="header">
      
                                                  <h:selectBooleanCheckbox id="selectAllBusinesses"
      
                                                      title="select all"
      
                                                      value="#{jobspecFilterController.selectAllBusinesses}">
      
                                                      <a4j:ajax event="valueChange"
      
                                                          listener="#{jobspecFilterController.checkboxListener}"
      
                                                          execute="@form" render="@form"
      
                                                          onbegin="#{rich:component('waitPopup')}.show()"
      
                                                          oncomplete="#{rich:component('waitPopup')}.hide()" />
      
                                                  </h:selectBooleanCheckbox>
      
                                              </f:facet>
      
                                              <h:selectBooleanCheckbox id="selectBusiness"
      
                                                  value="#{jobspecFilterController.businesses[business]}">
      
                                                  <a4j:ajax event="valueChange"
      
                                                      listener="#{jobspecFilterController.checkboxListener}"
      
                                                      execute="@form" render="@form"
      
                                                      onbegin="#{rich:component('waitPopup')}.show()"
      
                                                      oncomplete="#{rich:component('waitPopup')}.hide()" />
      
                                                  <f:attribute name="node" value="#{business}" />
      
                                              </h:selectBooleanCheckbox>
      
                                          </rich:column>
      
                                          <rich:column width="200px">
      
                                              <f:facet name="header"></f:facet>
      
                                              <h:commandLink id="linkBusiness" value="#{business.name}"
      
                                                  action="#{jobspecFilterController.fillTable(business)}"
      
                                                  rendered="true" />
      
                                          </rich:column>
      
                                      </rich:extendedDataTable>
      

       

      public void selectionListener(AjaxBehaviorEvent event) {
      
              if (!businessSelection.isEmpty()) {
                  UIExtendedDataTable dataTable = (UIExtendedDataTable) event.getComponent();
                  Object originalKey = dataTable.getRowKey();
                  String id = dataTable.getId();
                  // do something...
                  dataTable.setRowKey(originalKey);
              }
      
          }
      

       

      Thanks in advance!