Knockout.SimpleGrid 和嵌套对象
Knockout.SimpleGrid and nested objects
我有一个这样的对象:
{
"ObjectId": 20001,
"Time": "2008-07-12T23:30:00",
"NestedObject": {
"NestedObjectId": 45,
"ParameterName": "Heart Rate",
}
}
我的 SimpleGrid 数据映射很简单:
{ headerText: "Object Id", rowText: "ObjectId" },
{ headerText: "NestedObject", rowText: "NestedObject.NestedObjectId" },
{ headerText: "Time", rowText: "Time" }
它不绑定 NestedObject.NestedObjectId。有谁知道我是否必须延长淘汰赛才能获得此功能?还是内置的?
您可以使用 function
作为 rowText
的参数:
{
headerText: "NestedObject",
rowText: function (item) { return item.NestedObject.NestedObjectId; }
}
演示 JSFiddle. (The sample were taken from here: Paged grid)
我有一个这样的对象:
{
"ObjectId": 20001,
"Time": "2008-07-12T23:30:00",
"NestedObject": {
"NestedObjectId": 45,
"ParameterName": "Heart Rate",
}
}
我的 SimpleGrid 数据映射很简单:
{ headerText: "Object Id", rowText: "ObjectId" },
{ headerText: "NestedObject", rowText: "NestedObject.NestedObjectId" },
{ headerText: "Time", rowText: "Time" }
它不绑定 NestedObject.NestedObjectId。有谁知道我是否必须延长淘汰赛才能获得此功能?还是内置的?
您可以使用 function
作为 rowText
的参数:
{
headerText: "NestedObject",
rowText: function (item) { return item.NestedObject.NestedObjectId; }
}
演示 JSFiddle. (The sample were taken from here: Paged grid)