6 Replies Latest reply on Apr 18, 2011 11:49 PM by gh weng

    rich:column sortBy can not work.please help me,thanks

    gh weng Newbie

      i use version is jsf2.1 + richfaces4.0final

      this is my test demo:

       

       

      public class Capitals {

       

      private String state;

      private String name;

       

       

      public String getState() {

        return state;

      }

      public void setState(String state) {

        this.state = state;

      }

      public String getName() {

        return name;

      }

      public void setName(String name) {

        this.name = name;

      }

       

       

      @ManagedBean(name="capitalsBean")
      @RequestScoped
      public class CapitalsBean {
      List<Capitals> capitals=new ArrayList<Capitals>();

      public List<Capitals> getCapitals() {
        for(int i=0;i<10;i++){
         Capitals cap=new Capitals();
         cap.setName("test"+i);
         cap.setState("aab"+i);
         capitals.add(cap);
        }
        return capitals;
      }

      public void setCapitals(List<Capitals> capitals) {
        this.capitals = capitals;
      }

       

      }

       

      }

       

      <h:form>

              <rich:dataTable value="#{capitalsBean.capitals}" var="cap" width="300px" columnClasses="center"

              rows="5" id="ds"  sortMode="single">

                  <f:facet name="header">

                      <h:outputText value="Sorting Example"/>

                  </f:facet>

                 

                  <rich:column sortBy="#{cap.state}">

                      <f:facet name="header">

                          <h:outputText value="State"/>

                      </f:facet>

                      <h:outputText value="#{cap.state}"/>

                  </rich:column>

                  <rich:column sortBy="#{cap.name}">

                      <f:facet name="header">

                          <h:outputText value="name"/>

                      </f:facet>

                      <h:outputText value="#{cap.name}"/>

                  </rich:column>

                

                  <f:facet name="footer">

                      <rich:dataScroller for="ds"></rich:dataScroller>

                  </f:facet>

              </rich:dataTable>

          </h:form>

       

      it can page, but no sort of small arrow,. I still have what places need configuration?