how to bind model to kendo grid datasource
i have developed a web application using asp.net mvc4 and kendo ui tools..
in there i need to bind a model to grid datasource or schema directly
without creating fields in schema..
here is the code of my grid..
function LoadGridView() {
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "Items/ReadItemDetails",
dataType: "json"
},
create: {
url: "Items/InsertItemDetails",
dataType: "json"
},
update: {
url: "Items/UpdateItemDetails",
Type: "POST",
dataType: "jsonp"
},
destroy: {
url: "Items/DeleteItemDetails",
dataType: "json"
}
},
batch: true,
pageSize: 30,
schema: {
model: {
id: "ItmKy",
fields: {
ItmCd: { editable: true, nullable: true },
ItmNm: { editable: true, nullable: true },
Unit: { editable: true, nullable: true },
isAct: { editable: true, nullable: true }
}
}
}
});
}
i need to pass a model name to schema instead of this lines
schema: {
model: {
id: "ItmKy",
fields: {
ItmCd: { editable: true, nullable: true },
ItmNm: { editable: true, nullable: true },
Unit: { editable: true, nullable: true },
isAct: { editable: true, nullable: true }
}
}
}
i tried like this but then the grid is not working..
schema: {
model: @Model
}
can somebody please help me and tell that how can i bind a model to schema
or to DataSource if possible..
No comments:
Post a Comment