SortableTable

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

SortableTable

Postby rganna » Thu Jul 24, 2008 12:05 pm

I am using SortableTable in my project. I would like to know what events are getting fired when table is sorted by clicking on the columnheader? I need to do some customization based on the sorting of the column.

Any help in this matter is greatly appreciated.

Thanks,
rganna
 
Posts: 26
Joined: Fri Jun 20, 2008 12:50 pm

Postby JIDE Support » Thu Jul 24, 2008 1:03 pm

You can use SortableTableModel#addSortListener(). SortableTable#getModel() usually will give you the SortableTableModel.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby rganna » Fri Jul 25, 2008 7:31 am

Thanks for the reply...

May be I did not explain correctly..

I have multiple tables that extend SotableTable. all of these have some common data and some specific data. if this common data is sorted in one table, I want all these other tables to display the data as sorted. so when one table is sorted I want to fire an event that notifies all these other tables to sort their respective data... all I want to know is what kind of information is available when a table is sorted and how to access that information (what methods to use to get that information).

Any information is greatly appreciated.

Thanks,[/b]
rganna
 
Posts: 26
Joined: Fri Jun 20, 2008 12:50 pm

Postby JIDE Support » Fri Jul 25, 2008 9:10 am

SortableTableModel#getSortingColumns will tell you exact which columns are sorted and the direction.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby rganna » Fri Jul 25, 2008 12:59 pm

I have multiple table models in my code.

I have SortableTable that is wrapped in FilterableTableModel then I am also using AbstractMultipleTableModel. so when I issue the call tableModel.getModel().getActualModel() I get the actual Model it is created with...but if I want to get to SortableTableModel from one of these table Models what is the method to use for it? is there such a method available?

thanks,[/b]
rganna
 
Posts: 26
Joined: Fri Jun 20, 2008 12:50 pm

Postby JIDE Support » Fri Jul 25, 2008 1:20 pm

TableModelWrapperUtils has all the methods you need when dealing with TableModelWrapper.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby rganna » Mon Jul 28, 2008 6:21 am

How to get sorted column info and the direction from SortableTableModel#getSortingColumns() method.

Thanks,
rganna
 
Posts: 26
Joined: Fri Jun 20, 2008 12:50 pm

Postby JIDE Support » Mon Jul 28, 2008 9:14 am

List<SortItem> getSortingColumns()

It returns a list of SortItem. SortItem has the column index, and sort order.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby rganna » Mon Jul 28, 2008 9:24 am

Thanks for the reply...

after posting the question, I found it...

I have another question... what happens when sort is cleared... on a column... I see that the sortingColums() returns an empty list... but setting this empty list to other tableModels is not clearing the sorting for me...


how do I remove the sorting from other tableModels?

Thanks,
rganna
 
Posts: 26
Joined: Fri Jun 20, 2008 12:50 pm

Postby JIDE Support » Mon Jul 28, 2008 9:46 am

You can call reset() to clear it.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby rganna » Mon Jul 28, 2008 9:51 am

can this re-order the data in the table like it was before sorting? I am clearing the sort but the order remains as descending.. how do i put it back to the pre sorting condition?

is there an example showing how to use reset() method? should this be used on the tableModel?

thanks,
rganna
 
Posts: 26
Joined: Fri Jun 20, 2008 12:50 pm

Postby JIDE Support » Mon Jul 28, 2008 9:55 am

All the methods I mentioned are on SortableTableModel, unless it is explicitly specified.

You just call reset() without calling setSortingColumns(null).

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby rganna » Mon Jul 28, 2008 2:18 pm

Thnak you so much!! it worked only for two table models...

I have rows 4,1,0,2,3,5 as my rows after the sort and 0,1,2,3,4,5 after reset(), this only happened to two models and rest of the models have rows 4,1,0,2,3,5. How do i fix this? is there a way to find out whether a model is set to sorted once the sorting is done.

any help is greatly appreciated.

Thanks,
rganna
 
Posts: 26
Joined: Fri Jun 20, 2008 12:50 pm

Postby JIDE Support » Mon Jul 28, 2008 2:21 pm

I don't quite understand. Could you make a test case for it? It doesn't seem matter how many models you have.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 8 guests

cron