문제

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.

도움이 되었습니까?

해결책

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().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top