JSFiddle - React, Tailwind, and code Playground
by siliconsoul
HTML
<link rel="stylesheet" href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.default.min.css">
<script src="http://cdn.kendostatic.com/2012.2.710/js/kendo.web.min.js"></script>
<div id="grid">
</div>
<div id="log"></div>
JavaScript
var data = [
{
ProductID: 1,
ProductName: "ProductName 1",
Test1: "abc",
OrderDate: new Date(2011, 1, 1)
},
{
ProductID: 2,
ProductName: "ProductName 2",
Test1: "cat",
OrderDate: new Date(2011, 1, 2)
}
];
var log = $("#log");
$("#grid").kendoGrid({
dataSource: {
data: data,
batch: true,
pageSize: 30,
schema: {
model: {
id: "ProductID",
fields: {
ProductID: { editable: false, nullable: true },
ProductName: { validation: { required: true } },
Test1: { }
}
}
}
},
editable: true,
toolbar: ["save", "cancel"],
columns: [
"ProductName", "Test1"
],
edit: function(e){
e.model.one("set",function(e){
log.append('<br />(model set) ' + e.field + ': ' + e.value);
});
},
save: function(e) {
log.append('<br />(grid save)');
var myOtherFieldValue = e.model.set("Test1", e.values["ProductName"]);
}
});