John Hammond
John Hammond

Reputation: 99

How do I get PrimeFaces DataTable to sort?

I just can't get sorting working. I'm not sure if this should be posted in the Rain forums, because I am just using PrimeFaces for the first time, and purchased/installed the Rain layout. So I'm not sure whether Rain is causing this or not.

I define a standard p:dataTable and use:

<p:column headerText="Name" field="name" filterMatchMode="contains" />

And sort does not work.

Here is my p:dataTable definition:

<p:dataTable id="table" widgetVar="table" stripedRows="true" reflow="true"
  value="#{viewBean.dtos}"
  var="dto" selection="#{viewBean.dtos}" rowKey="#{dto.id}" paginator="true"
  rows="10" rowSelectMode="add">

My PrimeFaces version:

<!-- https://mvnrepository.com/artifact/org.primefaces/primefaces -->
<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>10.0.0-RC2</version>
</dependency>

Upvotes: 1

Views: 1491

Answers (1)

stefan-dan
stefan-dan

Reputation: 604

You are using a PrimeFaces version that has some bugs related to sort/filter data tables. Like this: DataTable/TreeTable: sortBy not working with client saving state method

You can apply the workarond, but you may face other issues, so it will be better if you switch to PrimeFaces 11, using the: PrimeFaces migration guide 10.0.0 -> 11.0.0

Upvotes: 2

Related Questions