Hello,
I am using a
jsp page to display a table that contains one to many rows and always four columns. The data is being returned from a service and each data object is a
String. I need to be able to allow the user to sort the table based on any of the four columns. For example if they select one of four options from a drop down then I could sort the respective column accordingly. Normally you could handle this easily with an ORDER BY added to the query but I am not able to change the query.
To get the data, I am parsing an xml document and creating multiple ArrayLists that represent each row and putting them into another ArrayList to represent the table.
I can use Collections.sort on each ArrayList but I can't figure out a way to rearrange the colums as an entire table. Is there a simple solution that I am overlooking?
This must be a common issue. I should add that I don't have to use ArrayLists. Any approach that can maintain some sort of table structure would work.
Any thoughts or direction would be greatly appreciated.
Richard