or
I have spent hours looking at the documentation and examples for datasource
CRUD the but cannot seem to get anything working. Can you see what I am missing below? I get "update is not a function" error. I have tried many variations of this code but no luck getting anything to update or delete.
function listMessagesInit(){
var messageDataSource = new kendo.data.DataSource({
transport: {
read: "/messages/data",
update: {
url: function(id, isnew) {
return "/messages/markasread/" + id + "/" + isnew ;
},
type: "POST"
},
destroy: {
url: "/messages/delete/210643",
type: "DELETE"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
}, //not sure what this does or even if I need it
error: function(e) {
alert(e.responseText);
},
schema: {
model: {
id: "id",
fields: {
created: "created",
message: "message",
customer_name: "customer_name",
isnew: "isnew"
}
}
},
/*change: function () {
$("#message_list").html(kendo.render(template, this.view()));
} */
});
$("#message_list").kendoMobileListView({
dataSource: messageDataSource,
//pullToRefresh: true,
appendOnRefresh: true,
style: "inset",
template: $("#message_list_template").text()
});
$("#markasread").click(function(){
messageDataSource.update({id: "216099", isnew:"1"});
messageDataSource.sync();
});