Kendo 网格情况
Kendo grid conditions
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"
}
]
here by "PrimaryPlaceOfPractice" db return 1 或 0。但是我想做的是我想在网格中显示 "Yes" 如果它 returns 1 和"No" if 0. 我该怎么做。有没有办法处理条件。有没有办法显示不同的值而不是从数据库中检索到的值。
/* ... */
columns: [
/* ... */
},{
field: "PrimaryPlaceOfPractice",
title: "Primary Place Of Practice",
template: "#=PrimaryPlaceOfPractice == 1 ? 'Yes' : 'No'#"
},{
/* ... */
]
/* ... */
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"
}
]
here by "PrimaryPlaceOfPractice" db return 1 或 0。但是我想做的是我想在网格中显示 "Yes" 如果它 returns 1 和"No" if 0. 我该怎么做。有没有办法处理条件。有没有办法显示不同的值而不是从数据库中检索到的值。
/* ... */
columns: [
/* ... */
},{
field: "PrimaryPlaceOfPractice",
title: "Primary Place Of Practice",
template: "#=PrimaryPlaceOfPractice == 1 ? 'Yes' : 'No'#"
},{
/* ... */
]
/* ... */