Skip to content

Table Sorting

olaf-boede edited this page Apr 4, 2014 · 7 revisions

PmTableImpl supports table row sorting.

Define a table/column as sortable

Each table column may be declared as sortable by defining @PmTableColCfg(sortable=PmBoolean.TRUE).
If all table columns should be sortable the table may be annotated: @PmTableCfg(sortable=true).

Initial row sort order definition

An initial row sort order defines the sort order that will be used when no column sort-by definition is active.

Default sort column definition

An sortable column may be used to specifiy the initial sort order:

  • @PmTableCfg(initialSortCol = "myCol") - defines an initial ascending sort order by 'myCol'.
  • @PmTableCfg(initialSortCol = "myCol,desc") - defines an initial descending sort order by 'myCol'.

For in-memory tables: Comparator based sort order

It can be defined as follows: @PmTableCfg(initialBeanSortComparator = MyComparator.class)

Service based tables

Sort order options for service based tables are configured within the QueryOptions instance provided by PmTableImpl.getPmQueryOptions(). In the next pm4j release (0.7) this configuration will be unified. The sort order will be annotation based for service based tables too.