0
在我的datasource
中,我的值爲或1
,您的值爲status
。基於此,我想在數據網格中顯示狀態的值爲"Active for Status=1" and "Inactive for Status=0"
。我怎樣才能相應地修改列值。我的數據網格是DEMO。Kendo UI數據網格:如何根據狀態標誌更改列顯示值整數值
代碼:
$(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" },
]
});
});
非常感謝隊友使用模板 –