How to sort treetable

J

John_Woo

Hi,
From sun's web, I found the example showing how to creaet treetable.
I'm wondering, what's the idea to sort it.

let's say I want the UI JTable like:
-----------------------------------------------------------------------------------------------------
Economy VS. Population
-----------------------------------------------------------------------------------------------------
Col_1-Region 2-GDP 3-Population
4-...
-----------------------------------------------------------------------------------------------------
World % million
...
A |-North.America
AB1 |-U.S.

AB2 |-Canada

ABC1 |-B.C

ABC2 |-ON

ABCD1 |-Toronto

ABCD2 |..

AB2 |-Mexico

B |-Europe

|--

C |-Asia

|-



It doesn't have to look as above, but the main point is, when clicking
on "2-GDP" header-column, tree-data should be sorted based on values on
that colunm.

The sort-rules are:

1. At least sort one level, ex. re-arrange A,B,C,etc
2. then sort to the lowest visible node, ex. re-arrange all ABs, then
for AB2 (Canada), re-arrange ABCs and then for ABC2, re-arrange
ABCDs;
3. for nodes become visible, sort them when clicking on the
header-column

Can any one have idea/example?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top