JDK-8102666 : TableView: Improved sorting support
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: fx2.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2012-02-06
  • Updated: 2015-06-16
  • Resolved: 2013-08-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
TableView has relatively powerful sorting support, but very little API to interact with it. This RFE is an umbrella issue for all TableView sorting related Jira issues, which may be targeted towards multiple releases.
Comments
All sub-issues have been resolved, so I'm marking this as resolved.
05-08-2013

Progress has been made on this issue, most notably by resolving RT-19482 and RT-17550. In addition the concept of a sort policy has been added to TableView and TreeTableView. This allows for sorting to be modified to suit the needs of developers.
11-03-2013

In addition to above, once tableview data gets updated but TableView looses its sort. Trying to sort later as per below doesnt seem to work - List<TableColumn<TableViewRow,String>> sortPattern = new ArrayList<TableColumn<TableViewRow,String>>(table.getSortOrder()); table.getSortOrder().clear(); table.getSortOrder().addAll(sortPattern); Can you please tell if there is any quick solution to manually update the TableView sort?
19-02-2013

Hi Jonathan, I'm too facing this same issue with TableView, after data changes the sort order is lost and even after calling (clear and add sort again) doesnt work. Any clue when this patch would be avaiable in beta to to test it out. Appreciate your help on this.
18-02-2013

Attaching proposed patch (which is still relatively undeveloped). The implementation will need to be more fleshed out, but this patch introduces the main concepts and new API. I am currently writing an openjfx-dev email which will summarise this patch.
17-02-2013

Unlike others, my issue is not about getting back to an unsorted state, I really do not care about that. My issue is that the column sort is not reapplied when table changes. Like other pointed out, I really do not see why the list we manipulate though the API is the very same list that the table uses for display. In "ideal world" there should be a second list behind the public one on which the column sort (if any) is applied before the table lays out its data for display. Now, of course avoiding duplication and twice memory usage is nice; but, without having that autosort property you were talking about and the table automatically reapplying sorting per selected column when the data changes, currently allowing the user to sort on a column is pretty much useless, broken and confusing (for said user) when that table has a data list that can change.
31-05-2012

Unfortunately this feature will not be developed in JavaFX 2.2 - the feature freeze for JavaFX 2.2 has already occurred, and therefore no more feature work can be done for this release. I hope to tackle this properly for Lombard. Technically it is a somewhat difficult problem to do efficiently: how do you record the initial state of the items list without having to create a copy of it? I'd love to hear your thoughts!
29-05-2012

Hi, I'd like to know if there is going to be an update in 2.2 with this set of features. In particular, I am now encountering the issue raised in RT-19445 and find that it's really weird that the table cannot restore its own sorting when a column (or more) has been set to sort and the data of the table changes. While I can understand the issues that Richard has pointed out in the discussion attached to RT-19445, I can also hear the shouts of customers complaining that the table column shows that a sort is apply when the new content in the table is clearly not (sorted).
29-05-2012