You can't sort a table by default, but you have to do it programmatically. With a little bit of work you can write a reusable PhaseListener
which you can control from your JSF page.
Make sure it only handles a single phase (for example PhaseId.RESTORE_VIEW
) and use it to set the sort order using setSortCriteria
:
List<SortCriterion> sortCriteria = new ArrayList<SortCriterion>(1);
String property = "myProperty";
boolean ascending = true;
sortCriteria.add(new SortCriterion(property, ascending));
myCoreTable.setSortCriteria(sortCriteria);
Now you only have to add two <f:attribute/>
s on your table to pass both the property name and the ascending boolean so you can create a reusable listener for all your tables.
In your <tr:document>
you can have a <f:attribute/>
with a list of table ID's to process.