Wednesday, November 08, 2006

JSF Data Tabel & Sort feature

Good Day to all!! Here I would like to explain sorting feature of JSF data table using myfaces, tomahawk datatabale tag; As all of us know, a table can be displayed using tag. Sorting functionality can be implemented in two ways.

1. Simple sort:
It works on default implementation (no backing bean code is required) To get it, make sortalbe attribute as true. You can make a specific column as default sorting on it. Have defaultSorted as
‘true’ for the column
Eg:















2. Custome Sort:
We can control the sorting behaviour programmatically. Sorting column can be capture in .jsp and logic implemented in backing bean
Eg:


sorting logic can be implemented in backing bean as below..(there are some additional methods too)



I hope this example helps you. I would appreciate your comments/feedback....

For more information: you can visit http://developers.sun.com/prodtech/javatools/jscreator/learning/bookshelf/

Thanks,
Adepu