grid json bind
HTML
<script src="http://cdn.kendostatic.com/2012.1.322/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.metro.min.css">
<div id="grid1"></div>
<div id="grid2"></div>
JavaScript
var ds1 = new kendo.data.DataSource({
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(
{
"country":[
{"codeLong":"AUT","codeShort":"AT","name":"Austria"},
{"codeLong":"BEL","codeShort":"BE","name":"Belgium"},
{"codeLong":"BGR","codeShort":"BG","name":"Bulgaria"}
]
}
)
}
}
},
schema: {
data: "country",
model: {
fields: {
codeLong: { type: "string" },
codeShort: { type: "string" },
name: { type: "string" }
}
}
}
});
var ds2 = new kendo.data.DataSource({
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(
[
{"codeLong":"AUT","codeShort":"AT","name":"Austria"},
{"codeLong":"BEL","codeShort":"BE","name":"Belgium"},
{"codeLong":"BGR","codeShort":"BG","name":"Bulgaria"}
]
)
}
}
},
schema: {
model: {
fields: {
codeLong: { type: "string" },
codeShort: { type: "string" },
name: { type: "string" }
}
}
}
});
$("#grid1").kendoGrid({
dataSource: ds1,
...