在 sap.m.Tree 中仅显示 JSON-模型的一部分
Display only parts of a JSON-Model in a sap.m.Tree
我有一个 UI5-JSON-模型,想在树中显示它。但我不想显示整个结构,而只是显示一个子集。假设我有以下模型:
{
"nodes": [
{
"text": "Leaf 1",
"additionalStuff": [
{
"element": "blue"
},
{
"element": "green"
}
]
},
{
"text": "Subtree",
"nodes": [
{
"text": "Leaf in Subtree"
}
]
},
{
"text": "Leaf 2"
}
]
}
我想显示 nodes
和 text
,但不显示 additionalStuff
。但是我得到的图片是这样的:
如何让树忽略 additionalStuff
?
您要找的是 sap.ui.model.json.JSONTreeBinding 中的参数 arrayNames
。
像这样绑定您的项目:
items="{path: '/nodes', parameters: {arrayNames: ['nodes', 'text']}}"
对于复杂的表达式绑定,您必须在引导程序中进行配置。
data-sap-ui-compatVersion="edge"
Complex syntax is automatically activated when the compatVersion is set to edge or to version 1.28 or higher.
我有一个 UI5-JSON-模型,想在树中显示它。但我不想显示整个结构,而只是显示一个子集。假设我有以下模型:
{
"nodes": [
{
"text": "Leaf 1",
"additionalStuff": [
{
"element": "blue"
},
{
"element": "green"
}
]
},
{
"text": "Subtree",
"nodes": [
{
"text": "Leaf in Subtree"
}
]
},
{
"text": "Leaf 2"
}
]
}
我想显示 nodes
和 text
,但不显示 additionalStuff
。但是我得到的图片是这样的:
如何让树忽略 additionalStuff
?
您要找的是 sap.ui.model.json.JSONTreeBinding 中的参数 arrayNames
。
像这样绑定您的项目:
items="{path: '/nodes', parameters: {arrayNames: ['nodes', 'text']}}"
对于复杂的表达式绑定,您必须在引导程序中进行配置。
data-sap-ui-compatVersion="edge"
Complex syntax is automatically activated when the compatVersion is set to edge or to version 1.28 or higher.