title: Sorting in an dynamically filled Datatable with lazy loading
body: <p>i have issues with my lazy loaded Datatable.
  First of all, here the code:</p>
  
  <pre><code> &lt;p:tabView&gt;
      &lt;!-- Tabs A and B, working fine --&gt;
      &lt;p:tab title="C"&gt;       
          &lt;p:commandButton value="get C" id="openC" actionListener="#{backingBean.initC}" render="cTable" update="cTable"&gt;&lt;/p:commandButton&gt;
          &lt;p:separator/&gt;
          &lt;p:dataTable id="cTable" var="cTable" value="#{backingBean.lazyC}" paginator="true" 
              paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
              rowsPerPageTemplate="5,10,15" rows="10" sortMode="multiple" lazy="true" rendered="#{backingBean.cAvailable}"&gt;
              &lt;c:forEach var="colC" items="#{backingBean.headerAllocationC}"&gt; 
                  &lt;p:column headerText="#{colC.header}" sortBy="#{cTable[colC.property]}"&gt;
                      &lt;div align="center"&gt;
                          &lt;h:outputText value="#{cTable[colC.property]}"&gt;&lt;/h:outputText&gt;
                      &lt;/div&gt;
                  &lt;/p:column&gt;
              &lt;/c:forEach&gt;
          &lt;/p:dataTable&gt;
      &lt;/p:tab&gt;
  &lt;/p:tabView&gt;
  </code></pre>
  
  <p>Following my sort-Method of my Lazy-Datamodel:</p>
  
  <pre><code>@Override
  public List&lt;cBean&gt; load(int first, int pageSize, List&lt;SortMeta&gt; multiSortMeta, Map&lt;String,Object&gt; filters){
      List&lt;cBean&gt; data = new ArrayList&lt;cBean&gt;();
      if (multiSortMeta != null) {
          for (SortMeta sortMeta : multiSortMeta) {
              System.out.println("SORTFIELD:" +sortMeta.getSortField());
              System.out.println("SORTORDER:" +sortMeta.getSortOrder());
              //System.out.println("SORTFUNCTION:"+sortMeta.getSortFunction());
              System.out.println("COLUMN:" +sortMeta.getColumn());
              System.out.println("CLASS:" +sortMeta.getClass());
          }
      }
      for (cBean c : datasource) {
          boolean match = true;
          if (filters != null) {
              for (Iterator&lt;String&gt; it = filters.keySet().iterator(); it.hasNext();) {
                  try {
                      String filterProperty = it.next();
                      Object filterValue = filters.get(filterProperty);
                      String fieldValue = String.valueOf(c.getClass().getField(filterProperty).get(c));
                      if (filterValue == null || fieldValue.startsWith(filterValue.toString())) {
                          match = true;
                      }
                      else {
                          match = false;
                          continue;
                      }
                  } catch (Exception e) {
                      match = false;
                  }
              }
          }
          if (match) {
              data.add(c);
          }
      }
      int dataSize = data.size();
      this.setRowCount(dataSize);
      if (dataSize &gt; pageSize) {
          try {
              return data.subList(first, first+pageSize);
          } catch (IndexOutOfBoundsException e) {
              return data.subList(first, first+(dataSize%pageSize));
          }
      } else {
          return data;
      }
  }
  </code></pre>
  
  <p>My Issue:
  The datatable gets rendered, and displays the data how it is supposed to do.
  Now I want to sort the table depending on one (or multiple) columns. The load method gets called, but the sortfield-string which is handed over to my load method is wrong (to be exact: "property]" gets printed).</p>
  
  <p>As far as i understand my syntax shouldn't be wrong, as I said the display of Data is totally correct. (so the syntax works just fine with the outputTexts, but doesn't work with my sortBy-clause in p:column?!)</p>
  
  <p>Is there an issue with my Syntax for primefaces-components?
  And why is only property] handed over, not the complete String? (i would somehow understand the situation if it was cTable[colC.property] which is handed over, but since its only the later part of the string i am utterly clueless to be honest.</p>
  
  <p>Would be great if so could clear things up for me and in the best case present a workaround :)</p>