JTable Sorting
4 posts in topic
Flat View  Flat View

Posted By:   suresh_thammina
Posted On:   Wednesday, January 28, 2004 02:49 AM

am using the JTable in that i want to sort data.
using Java code i have done sorting but after sorting if change the data in one cell then if press Tab to enter data
in the other cell then the data will get unsorted and it looks like a junk data.it should not happen ,the sorted data should be there itself.please send me solution for this
or if have any source code regarding JTable sort please send me.

Advace thanx

Re: JTable Sorting

Posted By:   Eugene_Ryzhikov  
Posted On:   Tuesday, February 17, 2004 05:11 PM

What you have to do is to put a filter model inbetween your JTable and original model. Your filter model should be able to sort your data and keep sorted references ( usually row indexes ) to original model.

Re: JTable Sorting

Posted By:   Vladimir_Zelenko  
Posted On:   Thursday, February 12, 2004 10:21 AM

I am not sure how you perform the sorting, but here is an idea. In your table model (if you are not using a custom one, you may want to) perform the sorting and store your data in a collection.

Hope this helps.

Re: JTable Sorting

Posted By:   John_Z  
Posted On:   Tuesday, February 3, 2004 08:19 AM

Make sure that you are sorting the underlying table model. After you sort the model's data, fire a change event to let the view (and any other listeners) know that it needs to redraw the table with fireTableDataChanged().

Re: JTable Sorting

Posted By:   George_Tzallas  
Posted On:   Friday, January 30, 2004 06:14 AM

You can check the JFC examples. In the standard JDK they can be found under


Check src/TableSorter.java


George T.

About | Sitemap | Contact