Skip to content

Instantly share code, notes, and snippets.

@incepttechnologies
Created October 9, 2013 18:27
Show Gist options
  • Save incepttechnologies/6905850 to your computer and use it in GitHub Desktop.
Save incepttechnologies/6905850 to your computer and use it in GitHub Desktop.
method showing setup of TableView for Sorting.
private void initializeTable() {
personViewIdCol.setCellValueFactory(new PropertyValueFactory<Person, String>("Id"));
id.setGraphic(upImg);
personViewIdCol.setGraphic(id);
personViewIdCol.setSortable(false);
personViewNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("Name"));
personViewNameCol.sortTypeProperty().addListener(new ChangeListener<SortType>() {
@Override
public void changed(ObservableValue<? extends SortType> paramObservableValue, SortType paramT1, SortType paramT2) {
System.out.println("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
id.setGraphic(null);
}
});
personViewAgeCol.setCellValueFactory(new PropertyValueFactory<Person, Integer>("Age"));
personViewAgeCol.setText("AGE");
personViewAgeCol.setSortable(false);
personView.getItems().setAll(persons.subList(0, itemsPerPage));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment