DiffObservableList doesn't work well with the items that extend BaseObservable
See original GitHub issueThe case is the following:
- my
DiffObservableList
contains item view models that extendBaseObservable
so that the items can be updated without updating the list (which is much heavier than finding an appropriate item in theDiffObservableList
and updating a text on it) - everything works fine, assuming that I’ll not call the
DiffObservableList.update
method with unmodified items. ThediffUtil
will not find any changes but theDiffObservableList
will update the internal list. The new items are not bound to the view so callingnotifyPropertyChanged
doesn’t have any effect.
I think the solution is to get rid of list update for items that did not change.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Work with observable data objects | Android Developers
There are three different types of observable classes: objects, fields, and collections. ... the Data Binding Library provides the BaseObservable class, ...
Read more >Why JavaFX TableView#setItems takes ObservableList<T ...
Just to sum up the comments: The reason why TableView<T> method setItems doesn't take ObservableList<? extends T> as argument, ...
Read more >ObservableList (JavaFX 8) - Oracle Help Center
A convenient method for var-arg adding of elements. void, addListener(ListChangeListener<? super E> listener). Add a listener to this observable list.
Read more >Handling single items using MVVM and Android Architecture ...
The model folder stores all my pojos which extends from databindings BaseObservable . Those setters are bindable and notify for changes.
Read more >Advanced Data Binding in Android: Observables
Learn how to use the Data Binding Library to bind UI elements in your XML layouts to data sources ... The UI doesn't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So I’m not really convinced that mixing mutable and immutable changes like this is a good idea. Either you should go down the mutable route and use
ObservableArrayList
and change things to match your data. Or you go the immutable route and submit a new list each time.Recently faced the same issue. My workaround is to get hash code from list with new items and compare it with hash code from old item’s list. If hash codes are not equal, DiffObservableList should be updated.