Knockout.js mapping not updating -


i have table of records. whenever data server want update field in viewmodel.

js:

$(document).ready(function () {      var data = json.parse($("#model").val());     var vm = new koviewmodel(data);     ko.applybindings(vm);      ....     //ajax call -> update viewmodel     {          vm.loaddata(data);     }  });  var koviewmodel = function (data) {     var self = this;     self.items = ko.mapping.fromjs(data);     };      self.getrecord = function (id) {         var match = ko.utils.arrayfirst(self.items(), function (item) {             return item.id() === id;         });         if (match) {             return match;         }     };      self.loaddata = function (data) {         $.each(data.componentbases, function (i, item) {             ko.mapping.fromjs(item, {}, self.getrecord(item.id));         })     }; }; 

html:

<tbody data-bind="foreach: items">     <tr>         <td data-bind="text: name"></td>         <td data-bind="text: verifyresult.message"></td>     </tr> </tbody> 

whenever call loaddata() function less 3 records updates fine. when have 3 or more @ least 1 of them not update though there match on id field.

what reason?


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -