Using Updatefromjs Is Replacing Values When It Should Be Adding Them
I have this code: var attachmentsModel = { convAttachments: ko.mapping.fromJS([]) }; $(function() { ko.applyBindings(attachmentsModel) refreshConvAttachments(); }); f
Solution 1:
ko.mapping.updateFromJS() expects that you are receiving the complete list of items that was originally prepared with ko.mapping.fromJS(). Any items that are missing from the original are considered to be deleted and any new items in the updates are considered additions. So, currently the mapping plugin will not allow you to do incremental updates in this way.
If you are doing incremental updates, your best bet would be to locate the items that you need to update and either replace them completely or replace individual observables on each item.
Post a Comment for "Using Updatefromjs Is Replacing Values When It Should Be Adding Them"