Kendo 网格列不显示 JSON 对象的字段
Kendo grid columns not displaying field off of a JSON object
我有一个 kendo 网格,定义如下:
$("#auditGrid").kendoGrid({
height: 650,
width: 650,
sortable: true,
filterable: true,
resizable: true,
columns: [
{ field: "ChangeTypeDescription", title: "Change Type" },
{ field: "LevelDescription", title: "Level" },
{ field: "Site.ShortName", title: "Site", width: "100px", },
{ field: "TimeStampLocal", title: "Date", type: "date", format: "{0: yyyy-MM-dd HH:mm:ss}" }
]
});
但是,标有 "Site" 的列没有显示任何内容,即使我知道那里应该有内容。将字段设置为 "Site" 而不是 "Site.ShortName" 会显示 [object Object] 的值,但每当我尝试在站点外显示 ShortName 时,它都会显示一个空列。所有其他列都正确显示。
有人知道为什么会这样吗?
数据源架构,以备不时之需:
schema: {
model: {
fields: {
ChangeTypeDescription: { type: "string" },
LevelDescription: { type: "string" },
Site: { type: "string" },
TimeStampLocal: { type: "date" }
}
}
},
需要使用模板功能来实现,将Site字段的列描述改成如下
{ field: 'Site', title: 'Site', template: '#= Site.ShortName# '}
我有一个 kendo 网格,定义如下:
$("#auditGrid").kendoGrid({
height: 650,
width: 650,
sortable: true,
filterable: true,
resizable: true,
columns: [
{ field: "ChangeTypeDescription", title: "Change Type" },
{ field: "LevelDescription", title: "Level" },
{ field: "Site.ShortName", title: "Site", width: "100px", },
{ field: "TimeStampLocal", title: "Date", type: "date", format: "{0: yyyy-MM-dd HH:mm:ss}" }
]
});
但是,标有 "Site" 的列没有显示任何内容,即使我知道那里应该有内容。将字段设置为 "Site" 而不是 "Site.ShortName" 会显示 [object Object] 的值,但每当我尝试在站点外显示 ShortName 时,它都会显示一个空列。所有其他列都正确显示。
有人知道为什么会这样吗?
数据源架构,以备不时之需:
schema: {
model: {
fields: {
ChangeTypeDescription: { type: "string" },
LevelDescription: { type: "string" },
Site: { type: "string" },
TimeStampLocal: { type: "date" }
}
}
},
需要使用模板功能来实现,将Site字段的列描述改成如下
{ field: 'Site', title: 'Site', template: '#= Site.ShortName# '}