knockout.js - Knockout mapping.fromJS does not map all properties -
i'm trying mapping viewmodel every time call ajax function mapping.fromjs not mapping properties of object.
i thought maybe problem property not declared, found solution here, i'm creating empty viewmodel templating server using viewbag.
here happening:
the data object has property "entregapai" id , viewmodel has value undefined, , after mapping:
the "entregapai" property still undefined rather others mapped well.
[edit]
here code:
// seleção de linha da lista - ajustar dados self.selectrow = function (row, event) { self.canrefreshsubtipopais = false; $.ajax({ url: template.urlget, method: 'get', contenttype: "application/json; charset=utf-8", data: { entregaid: row.entregaid() }, cache: false, success: function (data) { ko.mapping.fromjs(data,self.formdata); //change status of form, not relevant pbccadastrosframework.configuraestado("s", self); $(event.target.parentelement).addclass('success').siblings().removeclass('success'); } }); };
i use ko.mapping plugin lot of other forms in project in 1 problem occurs.
Comments
Post a Comment