kendo save and change events
HTML
<script src="http://cdn.kendostatic.com/2012.1.515/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.default.min.css">
<div id="grid1"></div>
<br />
<p> Another grid bound to the same dataSource </p>
<div id="grid2"></div>
JavaScript
var dataSource = new kendo.data.DataSource({
schema: {
model: {
id: "foo",
fields: {
foo: {type: "number"},
bar: {type: "string"},
isEditable: {type: "boolean"}
}
}
},
transport: {
read: {
//using jsfiddle echo service to simulate JSON endpoint
url: "/echo/json/",
dataType: "json",
type: "POST",
data: {
// /echo/json/ echoes the JSON which you pass as an argument
json: JSON.stringify([
{ foo: 1, bar: "a" },
{ foo: 2, bar: "b" },
{ foo: 3, bar: "c" }
])
}
},
update: {
url: "test"
}
},
change: function(e) {
/*
if(e.action == "itemchange"){
var item = e.items[0];
item.set("bar", "changed");
}
*/
}
});
$("#grid1").kendoGrid({
dataSource: dataSource,
editable: "inline",
toolbar: ["create", "save", "cancel"],
columns: [
"foo",
"bar",
{ command: "edit" }
],
save: function(e) {
var model = e.model;
model.set("bar", "modified at the save event");
}
});
$("#grid2").kendoGrid({
dataSource: dataSource,
columns: ["foo", "bar"]
});