我们正在Angular 5项目上使用Kendo Grid。
在html中,我们有:
对于kendo-grid-column字段=“属性-A.Code”-有效
但是kendo-grid-column field =“ Property-B.Property-B-One.CodeName”-不起作用
一个人如何访问层次结构下2个级别的数据?
感谢您的帮助。
答案 0 :(得分:0)
确保属性名称是有效的JavaScript标识符,除此之外,您还应该能够绑定两级和三级嵌套数据,例如:
<kendo-grid-column field="Category.CategoryName" width="200" title="Category - II level">
</kendo-grid-column>
<kendo-grid-column field="Category.nested.foo" width="200" title="Test - III level">
</kendo-grid-column>
public gridData: any[] = [
{
"ProductID": 1,
"ProductName": "Chai",
"SupplierID": 1,
"CategoryID": 1,
"QuantityPerUnit": "10 boxes x 20 bags",
"UnitPrice": 18,
"UnitsInStock": 39,
"UnitsOnOrder": 0,
"ReorderLevel": 10,
"Discontinued": false,
"Category": {
"CategoryID": 1,
"CategoryName": "Beverages",
"Description": "Soft drinks, coffees, teas, beers, and ales",
nested: {
foo: 'bar'
}
},
"FirstOrderedOn": new Date(1996, 8, 20)
},
{
"ProductID": 2,
"ProductName": "Chang",
"SupplierID": 1,
"CategoryID": 1,
"QuantityPerUnit": "24 - 12 oz bottles",
"UnitPrice": 19,
"UnitsInStock": 17,
"UnitsOnOrder": 40,
"ReorderLevel": 25,
"Discontinued": false,
"Category": {
"CategoryID": 1,
"CategoryName": "Beverages",
"Description": "Soft drinks, coffees, teas, beers, and ales",
nested: {
foo: 'baz'
}
},
"FirstOrderedOn": new Date(1996, 7, 12)
}];