Rowsorting of TableView with SortedList/FilteredList

Martin Klähn grazertwo at
Thu Aug 8 04:17:09 PDT 2013

Hi guys,

I'm working on a business application that makes use of TableView and I'm
working with JDK 8 build b101.

Displaying the data works like a charm. Row sorting for ordinary
ObservableLists is fine too.

Then I've set TableView.items to FilteredList and row sorting was disabled.
replacing TableView.item with SortedList does not allow row sorting as
well. Binding the comparator of SortedList to the TableView.comparator has
no effect either.

// row sorting possible
//final TableView<Integer> tableView = new
TableView<>(FXCollections.observableArrayList(2, 1, 3));

// row sorting not possible (SortedList)
// create a TableView with the sorted list set as the items it will show
// bind the sortedList comparator to the TableView comparator
//SortedList<Integer> sortedList = new
SortedList<>(FXCollections.observableArrayList(2, 1, 3));
//final TableView<Integer> tableView = new TableView<>(sortedList);

// row sorting not possible (FilteredList)
//FilteredList<Integer> filteredList = new
FilteredList<>(FXCollections.observableArrayList(2, 1, 3), (e) -> true);
//final TableView<Integer> tableView = new TableView<>(filteredList );

// Don't forget to define columns!
final TableColumn<Integer, Number> integerColumn = new
final TableColumn<Integer, String> hexColumn = new TableColumn<>("Integer

integerColumn.setCellValueFactory(javaClass -> new
hexColumn.setCellValueFactory(javaClass -> new

tableView.getColumns().addAll(integerColumn, hexColumn);

Any pointers on what I'm doing wrong or where I have to adapt my
Is it correct that row sorting in a TableView is only possible for ordinary

With Regards

More information about the openjfx-dev mailing list