Search code examples
sortingjsfjsf-2primefacestreetable

Sorting treeTable (primeFaces) is not working


I found information that primefacess now supports treeTable sorting. http://blog.primefaces.org/?p=3017

''Usage is same as datatable via sortBy attribute of columns''

But when I add sortBy attribute sort functionality doesn't display.

There's my treeTable in welcome.xhtml.

<h:form id="form">
        <p:treeTable id="treeTable"
                     value="#{treeCheckBox.root}" var="manager"
                     selection="#{treeCheckBox.selectedNodes}" selectionMode="checkbox">

            <p:column style="width:100px" sortBy="id">
                <f:facet name="header">
                    ID
                </f:facet>
                <h:outputText value="#{manager.id}"/>
            </p:column>

            <p:column style="width:100px" sortBy="description">
                <f:facet name="header">
                    Description
                </f:facet>
                <h:outputText value="#{manager.description}"/>
            </p:column>

            <p:column style="width:100px" sortBy="knowledgeDate">
                <f:facet name="header">
                    KnowladgeDate
                </f:facet>
                <h:outputText value="#{manager.knowledgeDate}"/>
            </p:column>
        </p:treeTable>
    </h:form>

And simple manager POJO.

    public class Manager implements Serializable{

        private static final long serialVersionUID = -1927658103477398301L;

        private String id;
        private String description;
        private String knowledgeDate;

        public Manager() {
        }

        public Manager(String id, String description, String knowledgeDate) {
            this.id = id;
            this.description = description;
            this.knowledgeDate = knowledgeDate;
        }}
//... getters and setters

Solution

  • Primefaces declares that they have sorting aproach for tree tale in 5 version. That was already released in may 2014.

    But still We can't filter treeTable. Hope it would be the next feature in the next releases.