How to learn, store and restore a table's 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.

How to learn, store and restore a table's columns order

Postby glenfiddick » Mon May 24, 2021 1:57 pm

Hello

I’m using the HierarchicalTable class in my program.

You know that users can drag and drop columns to reorder them. I want to be able to show the columns in the same order when that user closes and starts the program again.

Is there a way/method to save and then restore the column order?

(of course always same column names will be used in that table)
(of course i can save the order data into a local file)
(it would be nice to be able to store the width of the column too, but it's not a priority)

Thanks, have a nice day
glenfiddick
 
Posts: 4
Joined: Mon May 24, 2021 8:25 am

Re: How to learn, store and restore a table's columns order

Postby JIDE Support » Mon May 24, 2021 10:58 pm

TableUtils has the methods you are looking for.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37022
Joined: Sun Sep 14, 2003 10:49 am

Re: How to learn, store and restore a table's columns order

Postby glenfiddick » Tue May 25, 2021 1:31 am

JIDE Support wrote:TableUtils has the methods you are looking for.


Well, which ones?

Are you talking about saveColumnOrders that accepts JTable as parameter? (I couldn't find an explaination/documentation on that)
So should I turn whole table object to json, save it in file, and then load it and pass as a parameter?
glenfiddick
 
Posts: 4
Joined: Mon May 24, 2021 8:25 am

Re: How to learn, store and restore a table's columns order

Postby JIDE Support » Tue May 25, 2021 7:58 am

setTablePreferenceByName and getTablePreferenceByName
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37022
Joined: Sun Sep 14, 2003 10:49 am

Re: How to learn, store and restore a table's columns order

Postby glenfiddick » Wed May 26, 2021 1:27 am

JIDE Support wrote:setTablePreferenceByName and getTablePreferenceByName


Thanks a lot (:

a final question;
I should call getTablePreferenceByName when a change in the table is made (when a column is dragged, table is sorted, column width changed)
Which listeners should I use/add?

(I saw a sortChanged method but couldn't find any other related method)
glenfiddick
 
Posts: 4
Joined: Mon May 24, 2021 8:25 am

Re: How to learn, store and restore a table's columns order

Postby glenfiddick » Wed May 26, 2021 4:54 am

glenfiddick wrote:
JIDE Support wrote:setTablePreferenceByName and getTablePreferenceByName

a final question;
I should call getTablePreferenceByName when a change in the table is made (when a column is dragged, table is sorted, column width changed)
Which listeners should I use/add?


I have added a mouse listener to the header of the table.
Overriding MouseAdapter's MouseReleased works for me (i guess, for now :D)

Thanks a lot. Have a nice day
glenfiddick
 
Posts: 4
Joined: Mon May 24, 2021 8:25 am


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

Who is online

Users browsing this forum: No registered users and 1 guest

cron