hidden columns, order

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

hidden columns, order

Postby sohcan » Thu Oct 27, 2011 6:54 am

Hello,

Jide supports hiding columns of a JTable. When you reorder column (in TableColumnModel ie by drag and drop), hide it (with TableColumnChooserPopupMenuCustomizer) and then unhide it, the view order of columns is preserverd.
My problem is following. When some columns are hidden and possibly reordered I would like to retrieve all TableColumns (hidden and not hidden) in a view order (for hidden meaning the order where would they be if they got unhidden). I assume that this should be possible based on the above, however when I was looking for an API for that and I saw that TableColumnChooser can return hiden column indexes but of a TableModel which is not what I need.

I would appreciate feedback on that.

sohcan
sohcan
 
Posts: 4
Joined: Sun Sep 04, 2011 6:51 am

Re: hidden columns, order

Postby JIDE Support » Thu Oct 27, 2011 9:17 am

When a column is hidden, it does not have "view" index since it's not visible. It really depends on what are current visible columns arranged regarding how a hidden column gets inserted back to the table, i.e., it's very dynamic. That's why we didn't offer such an API to avoid confusing.

May I ask why you need know the "view" index of a hidden TableColumn. We'll see if we can find a better solution for you.

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

Re: hidden columns, order

Postby sohcan » Thu Oct 27, 2011 12:05 pm

Thanks for quick reply.
But somehow hidden columns preserve view index, because after unhiding they appear in "old place". I need to implement persistence for columns order, hidden state and some other column attributes. Having the order of columns in which jide sets them after unhiding columns would solve my problem. Without that I would consider my own hiding/unhiding columns mechanism.

sohcan
sohcan
 
Posts: 4
Joined: Sun Sep 04, 2011 6:51 am

Re: hidden columns, order

Postby JIDE Support » Thu Oct 27, 2011 12:28 pm

You could invoke TableUtils#getTablePreferenceByName()/setTablePreferenceByName() to persist the hidden state. You could add on the other column attributes on top of the string generated by TableUtils#getTablePreferenceByName().

As indicated in my previous post, it's dynamically calculated to get the "view" index of a hidden column. For example, say a table has 3 columns, A,B,C. If you hide the B, then it's displayed as A,C. If you show B right now, its view index is 1, i.e. A,B,C. However, if you rearrange the column order to C, A then try to show B, its view index will be 2, i.e., C, A, B.

If you look into the string generated by TableUtils#getTablePreferenceByName(), you would figure out that we have to store the entire history of how the customer rearrange the columns to calculate the view index correctly.

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

Re: hidden columns, order

Postby majid » Mon Nov 25, 2013 9:18 am

Hi,

Which listener I should add to my table to save the preference when I hide/show/reorder columns ?

Thanks
majid
 
Posts: 24
Joined: Fri Jan 25, 2013 9:40 am

Re: hidden columns, order

Postby JIDE Support » Mon Nov 25, 2013 9:32 am

You probably could use TableColumnModelListener to do it but I would just save it when the panel containing the table is hidden/closed to avoid too many calls to save preferences.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36468
Joined: Sun Sep 14, 2003 10:49 am

Re: hidden columns, order

Postby majid » Tue Nov 26, 2013 5:05 am

Thanks a lot, it is working :)
majid
 
Posts: 24
Joined: Fri Jan 25, 2013 9:40 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 4 guests

cron