【发布时间】:2018-01-09 05:54:03
【问题描述】:
在我的datasource 中,status 的值为0 或1。基于此,在数据网格中,我想将 Status 的值显示为 "Active for Status=1" and "Inactive for Status=0"。如何相应地修改列值。
这是我的数据网格的DEMO。
代码:
$(document).ready(function() {
var myData = [{
id: 1,
name: "Grant",
location: "A",
color: "green",
status: 1,
}, {
id: 2,
name: "Vaughan",
location: "B",
color: "red",
status: 0,
}, {
id: 3,
name: "David",
location: "A",
color: "orange",
status: 1,
}];
$("#grid").kendoGrid({
dataSource: {
data: myData,
schema: {
model: {
fields: {
id: { type: "number" },
name: { type: "string" },
location: { type: "string" },
color: { type: "string" }
}
}
}
},
columns: [
{ field: "id", title: "ID", width: "130px" },
{ field: "name", title: "Name", width: "130px" },
{ field: "location", title: "Location", width: "130px" },
{ field: "color", title: "Color", width: "130px" },
{ field: "status", title: "Status", width: "130px" },
]
});
});
【问题讨论】:
标签: jquery kendo-ui datagrid kendo-grid kendo-datasource