0 Replies Latest reply on Mar 3, 2009 4:21 AM by dgalland

    A trick to edit a String dataTable

    dgalland

      I try to edit a datable built from a list of String

      This code does not work (silently without an Exception):

      <rich:dataTable
       value="#{test.listString}"
       var="string"
       >
       <h:column>
       <h:inputText value="#{string}" />
       </h:column>
       </rich:dataTable>
      


      Where listString is a List of String
      Probably the EL expression #{string} is not a l-value or the string is not mutable.

      But this code works perfectly well:
      <rich:dataTable
       value="#{test.listString}"
       rowKeyVar="key"
       >
       <h:column>
       <h:inputText value="#{test.listString[key]}" />
       </h:column>
       </rich:dataTable>
      

      With this trick I can edit directly a list of String obtained from a bean. Before having discovered this trick I had to build a list of rows, every row containing one String.
      May be this trick can be useful for somebody