I have a TableView associated to a TreeView. Each time a node in the TreeView is selected, the TableView is refreshed with different data.
I am able to sort any col
You can also do this for 0 or more Sort-Columns:
List> sortColumns = new LinkedList<>(rooms.getSortOrder());
// rooms.setItems(...)
rooms.getSortOrder().addAll(sortColumns);
The reason why you create a new LinkedList is that you don't wanna just point at rooms.getSortOrder()
like this:
List> sortColumns = rooms.getSortOrder();
because this way both rooms.getSortOrder()
and sortColumns
will become empty after you call rooms.setItems(...)
which seems to clear the rooms.getSortOrder()
.