我已经使用 asp.net mvc4 和 kendo ui 工具开发了一个 Web 应用程序..
在那里我需要将模型直接绑定到网格数据源或模式,而不在模式中创建字段..
这是我的网格的代码..
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 }
}
}
}
});
}
我需要将模型名称传递给架构而不是这一行
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 }
}
}
}
我试过这样,但网格不工作..
schema: {
model: @Model
}
有人可以帮助我并告诉我如何将模型绑定到模式或数据源(如果可能)。
这是模型类
namespace KendoModel
{
public class ItemMas_LookUp
{
public long ItmKy { get; set; }
public string ItmCd { get; set; }
public string ItmNm { get; set; }
public int UnitKy { get; set; }
public int isAct { get; set; }
public string Unit { get; set; }
public ItemMas_LookUp()
{
}
}
}