Skip to main content

Sorting of JXTreetable ???

4 replies [Last post]
anandb4ever
Offline
Joined: 2010-07-19

I am using Jxtreetable with model that extends AbstractTreeTableModel.

I was thinking that one clicking on table's header will sort the treetable accordingly. But its not doing so. I want to implement the sorting of data on click to table's header of treetable.

Please suggest me any idea...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kameit00
Offline
Joined: 2007-12-20

You could use JXTable & GlazedLists TreeList to make a TreeTable. This works fine for me. With this solution you can sort within the 'virtual nodes' of your list. These nodes are constructed from a virtual path, that you define.

Imagine an object like: name, city, country
The virtual path would be:

vo --> "virtual object/node"

[code]
+ country (vo) | |
+ city (vo) | |
name | city | country (real object)
[/code]

kleopatra
Offline
Joined: 2003-06-11

good to know that .. would be great if you might consider to add a tutorial/article/code example to the SwingX wiki

Thanks
Jeanette

kameit00
Offline
Joined: 2007-12-20

Sorry for the late answer.
I'll add some code to the SwingX wiki as soon as I have some time to think about a small, comprehendible example. It's on my ToDo list now.
Regards
Kai

kleopatra
Offline
Joined: 2003-06-11

what is unclear in:

[code]
/**
* {@inheritDoc}

* Overridden to do nothing.
*
* TreeTable is not sortable because there is no equivalent to
* RowSorter (which is targeted to linear structures) for
* hierarchical data.
*
*/
@Override

[/code]

Guys and gals - the API doc is there for _reading_

CU
Jeanette

PS: the law-of-multiple question marks (remember? you were warned in one of your last posts) applies to the subject as well - only then the decrease is more like exponential )