dataSource: {
pageSize: 5,
serverPaging: false,
serverSorting: false,
schema: {
model: {
id: "EmploymentHistoryId",
fields: {
EmployerName: { validation: { required: true } },
JobTitle: { validation: { required: true } },
PrimaryPlaceOfPractice: { validation: { required: true } },
StartDate: { validation: { required: true } },
EndDate: { validation: { required: true } },
}
}
}
},
sortable: true,
pageable: true,
toolbar: ["create"],
editable: "popup",
autoSync: true,
columns: [
{
field: "EmployerName",
title: "Name of Employer"
},{
field: "JobTitle",
title: "Job Title"
},{
field: "PrimaryPlaceOfPractice",
title: "Primary Place Of Practice"
},
{
field: "StartDate",
title: "Start Date",
template: "#= kendo.toString(kendo.parseDate(StartDate, 'yyyy-MM-dd'), 'MM/dd/yyyy') #"
}, {
field: "EndDate",
title: "End Date",
template: "#= kendo.toString(kendo.parseDate(EndDate, 'yyyy-MM-dd'), 'MM/dd/yyyy') #"
},{
command: ["destroy", "edit"],
title: "Action"
}
]
这里是" PrimaryPlaceOfPractice" db返回1或0.但我想要做的是我想要显示"是"在Grid中,如果它返回1并且" No"如果0.我怎么能这样做。有没有办法处理条件。有没有办法显示不同的值而不是从数据库中检索的值。
答案 0 :(得分:2)
/* ... */
columns: [
/* ... */
},{
field: "PrimaryPlaceOfPractice",
title: "Primary Place Of Practice",
template: "#=PrimaryPlaceOfPractice == 1 ? 'Yes' : 'No'#"
},{
/* ... */
]
/* ... */