简体   繁体   English

对treeTable(primeFaces)排序不起作用

[英]Sorting treeTable (primeFaces) is not working

I found information that primefacess now supports treeTable sorting. 我发现primefacess现在支持treeTable排序的信息。 http://blog.primefaces.org/?p=3017 http://blog.primefaces.org/?p=3017

''Usage is same as datatable via sortBy attribute of columns'' ``用法与通过列的sortBy属性的数据表相同''

But when I add sortBy attribute sort functionality doesn't display. 但是,当我添加sortBy属性时,排序功能不会显示。

There's my treeTable in welcome.xhtml . welcome.xhtml中有我的treeTable。

<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. 和简单的经理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

As far as I understand it this functions is either only available for Primefaces 5 and/or Primefaces Elite. 据我了解,此功能仅适用于Primefaces 5和/或Primefaces Elite。 Since I don't see anything wrong with your code I assume that you use a free version of Primefaces 4. 由于我的代码没有发现任何问题,因此我假设您使用的是免费版本的Primefaces 4。

Primefaces declares that they have sorting aproach for tree tale in 5 version. Primefaces宣布他们有5种版本的树状分类方法。 That was already released in may 2014. 该内容已于2014年5月发布。

But still We can't filter treeTable. 但是我们仍然不能过滤treeTable。 Hope it would be the next feature in the next releases. 希望它将成为下一个版本中的下一个功能。

I think, you must change this : 我认为,您必须更改此设置:

false =  " sortBy="id">"
true = " sortBy="manager.id">"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM