0 Replies Latest reply on Aug 4, 2009 8:14 AM by sautna

    Sorting <rich:column>

    sautna

      Hi, I'm facing a problem sorting a rich:scrollabledatatable:

      Sorting works fine when I use a list of entity-objects, which look like this:

      public class Agent {
      
       private int id;
       private String storageSystemId;
       private String uid;
       private boolean active= false;
       private boolean truecopy= false;
       private Date activationDate;
       private Date registrationDate;
       private Date lastMessage;
       private int interval;
       private String comment;
       private String osType;
       private Host host;
      
       // getters and setters
      }
      


      with the following rich:scrollabledatatable:
      simplified snippet
      <rich:scrollableDataTable id="dashboard" rows="0" value="#{AgentActionBean.agentList}" var="item" selectionMode="none" >
       <rich:column id="id" >
       <h:outputText value="#{item.id}" />
       </rich:column>
       // more columns like above
      </rich:scrollableDataTable>
      



      The problem appears using a list of for example the following structure:
      public class AgentListItem {
      
       private Agent agent;
       private String test;
       private boolean checkbox;
      
       // getters and setters
      }
      


      The attributes "String test" and "boolean checkbox" can be sorted with no problems. But trying to sort a attribute inside the agent-object it fails:

      <rich:scrollableDataTable id="dashboard" rows="0" value="#{AgentActionBean.agentList}" var="item" selectionMode="none" >
      
       //works:
       <rich:column id="test" >
       <h:outputText value="#{item.test}" />
       </rich:column>
      
       //works:
       <rich:column id="checkbox" >
       <h:outputText value="#{item.checkbox}" />
       </rich:column>
      
       // doesn't work:
       <rich:column id="id" >
       <h:outputText value="#{item.agent.id}" />
       </rich:column>
      
      </rich:scrollableDataTable>
      


      I also tried to use the "sortBy" of rich:column and tried different ID namings...

      Can somebody help me with this issue?
      Thanks!