Using updateFromJS is replacing values when it should be adding them

前端 未结 2 1248
我在风中等你
我在风中等你 2021-01-26 04:42

I have this code:

var attachmentsModel = {
    convAttachments: ko.mapping.fromJS([])
};

$(function() {
    ko.applyBindings(attachmentsModel)
    refreshConvAt         


        
2条回答
  •  醉酒成梦
    2021-01-26 05:14

    you could always try using

    $.extend(attachmentsModel.convAttachments,ko.mapping.fromJS(dataJS));
    

    Although i am not quite sure if that will update all the bindings properly, you might have to reply the binding by calling

    ko.applyBindings(attachmentsModel)
    

提交回复
热议问题