So I'm using javafx ListView to represent some data in an application. The content of the listviewis bound like so
ListView<String> listView = new ListView<String>();
Bindings.bindBidirectional(listView.itemsProperty(), new SimpleObjectProperty<>(navigationItem.getItems()));
That way, when navigationItem.getItems() contents changes, the content of the listView does too.
My problem is the following: if there was n items in the lists, they are correctly dispayed, but when updating to less than that (let's say m), the m first are correct, but the n-m last items are the previous ones and are not cleared.
I'm updating my lists like so:
mItems.clear();
mItems.addAll(pItems);
mItems is the list the is returned by navigationItem.getItems().
One more thing, due to the way the ui is handled, I don't have access to the listview after initialization.
Thanks for your help.