Pages

Friday, January 11, 2013

JSF 2.x Tip of the Day: RichFaces Table Sorting (3-position switch design)

A technique I like to call the three position switch is what I use for sorting on my RichFaces tables. This consists of default (unsorted), ascending, and descending. It is implemented very easily by setting the <rich:column/> sortOrder attribute to point to our current sort, and using an <a4j:commandLink> in the header facet to control the sort as shown in the example below. This simple technique makes sorting simple and sexy.

code



This additional code will let the user know which sorting direction we are currently using.

3 comments :