I am working with Kendo Editable TreeList (with angular). I am trying to use the "transport" functionality to communicate with my remote service. While the read works fine (i.e. I get the JSON data and am able to render it correctly), the update functionality does not work correctly. To be specific, the options.models remains "undefined" and as a result nothing is sent back.
I ran the angular treelist example on kendo website in DOJO and the options.model there turns out to be undefined as well. (you can run it by editing the example here: http://demos.telerik.com/kendo-ui/treelist/angular)
What follows below is the code I am working with (which is similar to the one provided in the telerik's example in the above link)
Can someone please tell me what I might be doing wrong here?
Thanks a lot!
vm.treelistOptions = {
dataSource: {
transport: {
read:{
url: myURL,
dataType:"json"
},
update: {
url: myURL + "update",
dataType: "json",
type: "post"
},
parameterMap: function(options, operation) {
if (operation == "read") {
console.log("Transport READ works");
}
if (operation == "update"){
console.log("Transport UPDATE works");
console.log(options.models);
}
if (operation !== "read" && options.models) {
console.log("reached inside the IF in parammap");
return {models: JSON.stringify(options.models)};
}
}
},
schema: {
model: {
id: "stId",
parentId: "stLink",
fields: {
stId: {type: "number", editable: false, nullable: false},
stLink: {nullable: true, type: "number"},
stName: {validation: {required: true}},
v: {type: "number", editable:true}
}
}
}
},
sortable:true,
editable:true,
columns: [
{ field: "stName", title: "st", width: "150px" },
{ field: "v", title: "Ex v", width: "150px" },
{ command: ["edit"] }
]
}
After a bit of a research and comparing non-angular v/s angular examples on Kendo, I figured their angular example with parameterMap was missing the batch=True option. This goes right after transport and just before schema section in the comparable non-angular example...which seems to fix the issue