View Full Version : Struts 2.0 and display tag sorting
Robin John
09-10-2008, 12:58 PM
hi,
'm using display tag with struts 2.0, want to sort multiple columns having multi levels of sorting? any ideas would be helpful
THANKS IN ADVANCE !
Robin John
09-25-2008, 01:23 PM
hi friends, this issue is fixed,
You just have to do a sort="external" in the table tag.(After doing this your display table tag wont sort your list.)
then you have to...
1) write a comparator class.
2) write the multilevel compare logic in comparator.
3) sort your list before setting in action class, using collections.sort or arrays.sort invoking the previous comparator you made.
EXAMPLE - Arrays.sort(customArray, new YourComparator(Column_Name, Sort_Order));
and voila ! you got sorting done. :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.