JSF sort table with Ajax

Here is an example of sorting a table with ajax. I’m using using a generic comparator which I implmented a while ago to sort the list items, it saves me few lines of code actually.
If you are intrested in the generic comparator



  • Be sure to use the new annotations(CDI) for sessionscoped,old ones will be deprecated with the next version of jsf
  • First we populate the list with some test data
  • I use datamodel as container for items nad get the list of items from it
  • Generic comparator helps me sort the list according to the field


Recent Posts