Sorting using multiple columns.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, July 28, 2004 12:48 AM

Hi,


I have a page that displays a table with strings coming from collections in multiple columns. When i click on the header, i want the table to be sorted by that column.

Can anyone please give me a sample code for the same. This is urgent.


Thanks in Advance.


Ravi.

Re: Sorting using multiple columns.

Posted By:   Rakesh_Ranjan  
Posted On:   Wednesday, July 28, 2004 10:12 PM


Hi Ravi

Your problem can be sloved by using TreeMap/TreeSet.

Let's say Employee Name, Employee ID and Employee Salary have to displayed on Page

On click of Employee ID Header rows have to displayed on the sorted order of Employee ID

In this case put employee ID as key in TreeMap and all rows will be automatically sorted.

Hope this will help you.

Suggest you to make a Model class for the displayable columns.


Thanks and Regards
Rakesh Ranjan

About | Sitemap | Contact