File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Sorting of Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sorting of Table" Watch "Sorting of Table" New topic
Author

Sorting of Table

Dhaval Shah
Greenhorn

Joined: Apr 26, 2004
Posts: 4
I have a quick question for you.
I have a table with three columns. The table is generated dynamically so can�t tell about the rows. Once data has been displayed user can sort (ascending or descending) the data of table by clicking the any of the header.
Awaiting reply.
Dhaval
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
So what's the issue actually? You've some codes that need help in debugging? Or you need suggestions on how to approach your problem?
Anyway, you need to be more specific in your question, if not its rather difficult to help you.
I'm assuming that each row of your table is essentially a Javabean. So you can actually use Comparator to sort them according to your needs (column).


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Dhaval!
In what context is your GUI running? Is it a web page of a web application? Is it a Swing / AWT based GUI?
Either way, you're possibly going to be taking advantage of the compareTo method of the Comparable interface.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dhaval Shah
Greenhorn

Joined: Apr 26, 2004
Posts: 4
Hi Guys,
Let me be more elaborate on this. I am fetching data from database and displaying it on web page (html) in a table format. By clicking the header of the table I want to sort the data of table with the help of javascript.
This can be done by going back to server, fetching the data according to new sorting order and display it again. But instead of going back to server I want to use javascript if available.
Thanks in Advance,
Dhaval
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
JavaScript is not Java.
Let me repeat. JavaScript is not Java.
Say it ten times.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
JavaScript is not Java.
Moving this to the HTML and JavaScript forum...
[ April 28, 2004: Message edited by: Dirk Schreckmann ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sorting of Table