Question

Using JavaFX 8 new feature SortedList, binded to a TableView sorting comparator. my implementation looks like :

SortedList<T> sorted = myObservableList.sorted();
myTable.setItems(sorted);
sorted.comparatorProperty().bind(myTable.comparatorProperty());

myObservableList is an empty ObservableList at startup. I set myTable comparator property through FXML.

My use case is :

  1. populate myObservableList with data (sorting and display are working bot fine)
  2. clear myObservableList -> throw java.lang.ArrayIndexOutOfBoundsException with a negative index
  3. re-populate myObservableList with some other data

I don't know why clearing the backed list myObservableList throws an error. Why the sortedlist is looking for indices while clearing ? I tried first to clear the sorted list, but this operation not supported.

Was it helpful?

Solution

I upgraded to the latest build Build b114 and that fixes the bug, as it really sounds like an FX bug

But, be careful, now the addAll() breaks, need to create a for loop and call add().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top