List of usage examples for javafx.scene.control TableView getSortOrder
public final ObservableList<TableColumn<S, ?>> getSortOrder()
From source file:com.ggvaidya.scinames.dataset.DatasetSceneController.java
private void fillTableWithChanges(TableView<Change> tv, Dataset tp) { // Preserve search order and selected item. List<TableColumn<Change, ?>> sortByCols = new LinkedList<>(tv.getSortOrder()); List<Change> selectedChanges = new LinkedList<>(tv.getSelectionModel().getSelectedItems()); LOGGER.info("About to set changes table items: sortByCols = " + sortByCols + ", selectedChanges = " + selectedChanges);//from w w w. j a v a2 s . co m tv.setItems(FXCollections.observableList(tp.getAllChangesAsList())); LOGGER.info("tv.setItems() completed"); for (Change ch : selectedChanges) { tv.getSelectionModel().select(ch); } tv.getSortOrder().addAll(sortByCols); LOGGER.info("fillTableWithChanges() completed"); }