File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Sorting the fields of a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Sorting the fields of a table " Watch "Sorting the fields of a table " New topic

Sorting the fields of a table

bobby chaurasia
Ranch Hand

Joined: Mar 30, 2002
Posts: 84
I'm using struts framwork. The data for populating the table is fed from the database using jdbc. The output is displayed in the table.
The format is something like this
S.No | Date | Amount | Details |
1 | 20.02.2003 | 100 | abc |
I'm able to display the details in the table. I need to incorporate the
functionality where in if the user clicks on Date or Amount ( which are displayed as a link ), the application should sort the rows in acending order. Also I want to display only 10 entries per page and provide
1 2 3 4 ( pages link) so that once the user clicks on these the next 10 entries are displayed.
Thanks in advance
[ December 10, 2003: Message edited by: bobby chaurasia ]
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 862
Check out the FormattedDataSet. It can easily sort columns by clicking them. There is a live demo off of that allows you to enter any sql and have it display as a sortable HTML table with clickable column headers. - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
bobby chaurasia
Ranch Hand

Joined: Mar 30, 2002
Posts: 84
Thanks Steve,I did have a look I guess what I am looking for is achieving this using the struts custom tags. Thanks
I agree. Here's the link:
subject: Sorting the fields of a table
jQuery in Action, 3rd edition