primeNg 获取节点属性
primeNg get Nodes attribute
我有这个 json 输出:
{
"data":
[
{
"label": "The Avengers",
"data": { "name" : "The Avengers", "type" : "book"},
"expandedIcon": "fa-folder-open",
"collapsedIcon": "fa-folder",
"leaf": true
},
{
"label": The Ring",
"data": { "name" : "The Ring", "type" : "movie"},
"expandedIcon": "fa-folder-open",
"expandedIcon": "fa-folder-open",
"collapsedIcon": "fa-folder",
"leaf": false
}
]
}
在我的模板中,我想获取叶的值和每个节点的 expandedIcon 属性,但我不知道该怎么做:
<ng-template pTemplate="body" let-rowNode let-rowData="rowData">
<tr>
<td>
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler>
{{rowData.title}}
</td>
<td>{{rowData.type}}</td>
<td>{{rowNode.leaf}}</td>
</tr>
</ng-template>
rowNode.leaf 为空。如何获得他的价值?因为我没有在文档中看到示例
谢谢
你需要
<td>{{rowNode.node.leaf}}</td>
我有这个 json 输出:
{
"data":
[
{
"label": "The Avengers",
"data": { "name" : "The Avengers", "type" : "book"},
"expandedIcon": "fa-folder-open",
"collapsedIcon": "fa-folder",
"leaf": true
},
{
"label": The Ring",
"data": { "name" : "The Ring", "type" : "movie"},
"expandedIcon": "fa-folder-open",
"expandedIcon": "fa-folder-open",
"collapsedIcon": "fa-folder",
"leaf": false
}
]
}
在我的模板中,我想获取叶的值和每个节点的 expandedIcon 属性,但我不知道该怎么做:
<ng-template pTemplate="body" let-rowNode let-rowData="rowData">
<tr>
<td>
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler>
{{rowData.title}}
</td>
<td>{{rowData.type}}</td>
<td>{{rowNode.leaf}}</td>
</tr>
</ng-template>
rowNode.leaf 为空。如何获得他的价值?因为我没有在文档中看到示例
谢谢
你需要
<td>{{rowNode.node.leaf}}</td>