My view displays a list composed objects all stored in koObservableArray MM.slideWellThumbnails
The objects are displayed using data-bind="foreach: slideWellThumbnails"
I couldn't get an individual view of an object updated, when only one property (e.g. confirmed ) of an object was changed.
- I've tried to call:
MM.slideWellThumbnails.valueHasMutated(); - I've declared the array with:
MM.slideWellThumbnails.extend({notify: 'always'});
It didn't help.
What I'm currently doing is, making a copy of the array, clearing the entire array and then pushing the data back to the array. It works, but I guess it is not as the KO-inventor ment it.
MM.slideWellThumbnails()[ +well ].confirmed = confirmed;
MM.slideWellThumbnails1([]);
ko.utils.arrayForEach( MM.slideWellThumbnails(), function(data)
{
MM.slideWellThumbnails1.push( data );
});
MM.slideWellThumbnails([]);
ko.utils.arrayForEach( MM.slideWellThumbnails1(), function(data)
{
MM.slideWellThumbnails.push( data );
});
Is there an efficient way to do it?
confirmeditself is just a simple property, not ako.observable? The "correct" way to do it would be for it to be an observable that you can update the value of, without touching the array at all