0 Replies Latest reply on Aug 6, 2013 8:59 AM by richard.waehner

    ajaxKeys with Strings

    richard.waehner

      Hi,

       

      is it possible to use Strings as ajaxKeys and if yes, how does it need to be implemented?

       

      In the last post of this thread Ilya points out that ajaxKeys use "simple Integers by default", which gives me some hope to be able to use Strings also.

       

      My dataModel already uses Strings as rowKey, which leads also to table row ids without integer, but the string as "index".

       

      But if I put the same information in my keysToUpdate Set nothing happens in the gui. What needs to be changed here or isn't it possible to use Strings with RF3.3.3?

       

      Faclet-Code

      <rich:dataTable
                      id="dt_eiList"
                      value="#{carCenter.dataModel}"
                      var="item"
                      ajaxKeys="#{carCenter.keysToUpdate}">
      ...
      </rich:dataTable>
      

       

      Generated-Column IDs

      id="f_list:dt_list:opel:col_select"
      
      instead of
      
      id="f_list:dt_list:0:col_select"
      

       

      DataModel snippet

       

      public class CarTableModel extends ExtendedDataModel implements Modifiable {
          private String currentPrimaryKey;
      
          @Override
          public String getRowKey() {
              return currentPrimaryKey;
          }
      
          @Override
          public void setRowKey(final Object primaryKey) {
               this.currentPrimaryKey = (String) primaryKey;
          }
      }
      

       

      Session-Bean snippet

      @Name(CarCenter.BEAN_NAME)
      @Scope(ScopeType.SESSION)
      public class CarCenter {
          private Set<String> keysToUpdate;
      
          public void init() {
      
              // initialize data structures
              keysToUpdate = new HashSet<String>();
          }
      
          public void update() {
             keysToUpdate.add("opel");
          }
      
          public Set<String> getKeysToUpdate() {
               return keysToUpdate;
          }
      }