PhotoAlbum Application Download Support Developer Guide
Skins:
Resources/Beans Handling
Ajax Miscellaneous
Built-in Sorting Feature
External Sorting

Rich Data Table has columns sorting feature built-in. The simplest way to add sorting capability is to define sortBy attribute at column you need to be sortable.

In this attribute you should define iterable object property which should be used when sorting performed.

In this example you could see that two first columns are sorted after a click on the corresponding header.

Sorting DataTable example
Sorting Example
State Name
State Capital
Time Zone
AlabamaMontgomeryGMT-6
AlaskaJuneauGMT-9
ArizonaPhoenixGMT-7
ArkansasLittle RockGMT-6
CaliforniaSacramentoGMT-8
ColoradoDenverGMT-7
ConnecticutHartfordGMT-5
DelawareDoverGMT-5
FloridaTallahasseeGMT-5
GeorgiaAtlantaGMT-5
HawaiiHonoluluGMT-10
IdahoBoiseGMT-8
IllinoisSpringfieldGMT-6
IndianaIndianapolisGMT-5
IowaDes MoinesGMT-6
Details of usage

Next attributes could be defined to manage simple built-in sorting:

  • sortMode - attribute of rich:dataTable which could be defined as "single"(Default) and "multiple". If multiple sorting defined - previous sorting will not be reset. Column will be sorted
  • sortOrder - attribute of rich:column allows to set initial sorting on the column. (Additional ways of usage to customize sorting described at "External Sorting" tab). Possible values are "ASCENDING", "DESCENDING" and "UNSORTED"(default)
  • selfSorted attribute of rich:column which defines if the table will make a header clickable and if click on the header will call sorting request. Default value is "true". In order to use custom sorting mechanism use value "false" for this attribute.


View Source
RichFaces Wiki RichFaces Project Site