vendredi 5 décembre 2014

Knockout mapping Json Array to Observable Array get error


Vote count:

0




I´ve an problem to map my json array to an observable array.


I´ve got an error "Cannot read property 'fromJSON' of undefined"


This are my linked knockout scripts:


knockout-3.2.0.js knockout.mapping-latest.js knockout.mapping-latest.debug.js


My Json array looks like this:



[
{"$id":"1","GR":10},
{"$id":"2","GR":20},
{"$id":"3","GR":30},
{"$id":"4","GR":40},
{"$id":"5","GR":50},
{"$id":"6","GR":60},
{"$id":"7","GR":70},
{"$id":"8","GR":80}
]


And This is my vieModel:



function FormViewModel() {

var self = this;
self.CpGrp = ko.observable([]);
self.GR = ko.observableArray();

$(document).ready(function (){

....


done: function (e, data) {
$(".progress").removeClass("progress-striped active"); // we're done

debugger;

var test
$.getJSON("/api/Points",
function (dataa) {
dataType: 'json'

test = ko.toJSON(dataa);

ko.mapping.fromJSON(test, {}, self)


}
)},


ko.applyBindings(new FormViewModel());


Where is the Bug?



asked 5 mins ago







Knockout mapping Json Array to Observable Array get error

Aucun commentaire:

Enregistrer un commentaire