« Return to Thread: TreeTable: sorting leaf nodes via TableComparatorChooser

Re: TreeTable: sorting leaf nodes via TableComparatorChooser

by Jesse Wilson :: Rate this Message:

Reply to Author | View in Thread

On Sun, May 10, 2009 at 4:26 AM, Holger Brands <hbrands@...> wrote:
You've setup a TreeTable with a default sorting
for each depth via appropriate comparators
returned by the TreeList.Format.
Now suppose you'd want to change the sorting
of the current leaf nodes based on "selected"
column(s), e.g. you want to click on a column header
and *resort the current leaf nodes only* according to
the values of that column.


Yeah, you'll need to create a TreeFormat whose Comparator knows about the TableFormat and the selected columns.

Whenever you need to sort 'leaves only' it's necessary to differentiate between leaves and non-leaves. Therefore that sorting mode isn't really appropriate for "variable depth" trees like file browsers.

 « Return to Thread: TreeTable: sorting leaf nodes via TableComparatorChooser