or
<
script
>
var blankData;
$(document).ready(function () {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
dataType: "json",
type: "POST",
data: {"SQLCMD":"SELECT * FROM gridTest","Table":["firstName","nickName","lastName"],"PrimaryKey":"PeopleID"} // this JSON data serves as parameters when returning data from the database
},
update: {
type: "POST"
},
destroy: {
type: "POST"
},
create: {
type: "POST"
}
},
// determines if changes will be send to the server individually or as batch
batch: true,
//...
pageSize: 30,
data: blankData,
autoSync: true,
schema: {
model: {
id: "PeopleID",
fields:
{"PeopleID":{"editable":false,"nullable":true},"firstName":{"type":"email","validation":{"required":true},"nullable":false},"nickName":{"type":"string","validation":{"required":true},"nullable":false},"lastName":{"type":"string","validation":{"required":true},"nullable":false}} }
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 260,
toolbar: ["create"],
columns:
[{"field":"firstName","title":"First name"},{"field":"nickName","title":"Nick Name"},{"field":"lastName","title":"Last name"},{"command":"destroy","title":" ","width":"110px"}] ,
editable: true
});
});
</
script
>
(function (mstats, $) {
var Product = kendo.data.Model.define({
ProductId: "ProductId"
})
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "../api/Product/GetAllProduct",
dataType: "json"
}
},
schema: {
model: Product
}
});
$('#grid').kendoGrid({
dataSource: dataSource,
selectable: true,
columns: [
{
Field: "ProductId",
title: "Product-Id"
},
{
field: "ProductName",
title: "Product-Name"
}]
});
} (this.mstats = this.mstats || {}, jQuery))