[REVIEW REQUEST] Improvements to TableView sorting
jonathan.giles at oracle.com
Mon Feb 18 13:37:24 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,
>> 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?
Right. To clarify: when a SortedList is set in the TableView items list
the TableView _will not_ sort it (either by actually performing a sort
or by modifying the Comparator on the SortedList). The TableView _will_
modify the TableView.comparator property to represent what the user has
requested, but this is not necessarily the guaranteed visual state.
And yes, you can bind the SortedList comparator to the TableView
comparator to get the expected sorting support.
> 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)?
Mutation will happen on the users list as currently occurs - there will
be no internal SortedList.
More information about the openjfx-dev