[REVIEW REQUEST] Improvements to TableView sorting

Knut Arne Vedaa knut.arne.vedaa at broadpark.no
Mon Feb 18 13:29:51 PST 2013

> The above outline essentially allows for features 2), 3), 4) and 5) from
> the list above. The only feature missing therefore is 1), which is
> support for returning to an unsorted state. The solution to this is to
> have a special-case support inside TableView / SortedList such that the
> developer may do what I mentioned above (namely,
> sortedList.comparatorProperty().bind(tableView.comparatorProperty())),
> and when the tableView.sortOrder list is empty the TableView /
> SortedList will take that to mean there is no sort desired and to return
> to the original, unsorted state.
> The other important note to make is that if you as the developer provide
> the TableView with a SortedList this is telling the TableView not to
> sort the collection or modify the Comparator if the user / developer
> changes the sortOrder (e.g. by clicking on the column headers). In other
> words, a TableView with a SortedList can not have its sort order changed
> by default. Of course, if you DO want the Comparator to be changed in
> your SortedList (and to support unsorted state as above), you can simply
> bind the comparator of the list to the tableview comparator.

This is not very clear to me. It seems that you indicate there are two 

A) The list you provide to TableView is a SortedList.

B) The list you provide to TableView is not a SortedList.

So in A), TableView will not do any sorting of its own, and it will not 
modify its comparator (or are you talking about SortedList's 
comparator?), but you can still bind the comparator to your SortedList?

And in B), will sorting happens as it currently does, i.e. by mutating 
the user's list, or will TableView have an internal SortedList (as 
discussed previously)?

Knut Arne Vedaa

More information about the openjfx-dev mailing list