I confirm the findings that Fairoz made. JDK 8 has two issues and JDK 9 has one. The issue with sorting not being persisted has existed since TreeTableView was introduced. I created a test application that has a TreeTableView and a TableView, and can see that the issue only exists in TreeTableView (which isn't surprising - the sorting code is completely different in both, and TreeTableView is less used than TableView).
It's conceivable that a fix could be developed for 8 or 9 that resolves the sorting issue in TreeTableView, but it won't be a trivial or quick fix, so I'll await direction on how to proceed.
The other issue (the exception) is one I am quite familiar with - it was something that was worked through and fixed in JDK 9. A backport isn't likely (without significant amounts of code), but it might be possible to resolve the issue with a new fix. Again, this is likely to have some risk associated, so there will need to be considerable time invested in testing and validation.
05-09-2017
Jonathan, can you please look at these two issues to assist Sust?
31-08-2017
There are 2 issues reported here.
Issue 1. TreeTableView selection changes on sorting action
Issue 2. There is an exception followed by that
Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: [ fromIndex: 0, toIndex: 3, size: 1 ]
at javafx.controls/com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.subList(ReadOnlyUnbackedObservableList.java:170)
at javafx.base/javafx.collections.ListChangeListener$Change.getAddedSubList(ListChangeListener.java:242)
at javafx.controls/javafx.scene.control.ControlUtils.updateSelectedIndices(ControlUtils.java:168)
at javafx.controls/javafx.scene.control.TreeTableView$TreeTableViewArrayListSelectionModel.fireCustomSelectedCellsListChangeEvent(TreeTab
leView.java:3254)
Below are the results
1. 9 ea b 181 -> only issue 1 is observed
2. 8u152 -> both issue 1 and issue 2 are observed
Issue 2 (Exception) got resolved in 9 ea b147. Below are the results
9 ea b146 (Issue 1 and Issue 2)
9 ea b147 (Only Issue 1)
9 ea b181 (Only Issue 1)
8u144 (Issue 1 and Issue 2)
8u152 (Issue 1 and Issue 2)