我一直在尝试实现多级层次结构数据的sap.m.tree,并且属性名称不同。
我已阅读 FIORI 指南 https://experience.sap.com/fiori-design-web/tree/同样,我知道这就是我需要的精确控制。从SAPUI5探索https://sapui5.hana.ondemand.com/explored.html#/entity/sap.m.Tree/samples
我无法获得太多帮助,因为他们有相同数据的示例,并且没有聚合。
任何人都可以帮助我引导,一个例子将不胜感激。
Json
{
"d": {
"__count": "4",
"results": [
{
"ID": "1234",
"FID": "00145E9279201EE799E3027FBE864F24",
"FName" : "Header"
"Sequence": 0,
"Values": {
"results": [
{
"ID": "321",
"Value": "FChild",
},
{
"ID": "321",
"Value": "FChild",
}
]}
}]
}
}
最佳答案
答案迟到了,但也许对其他人有帮助。 树的 json 结构应该类似于 this :
[
{
"text": "Node1",
"ref": "sap-icon://attachment-audio",
"nodes":
[
{
"text": "Node1-1",
"ref": "sap-icon://attachment-e-pub",
"nodes":[
{
"text": "Node1-1-1",
"ref": "sap-icon://attachment-html"
},
{
"text": "Node1-1-2",
"ref": "sap-icon://attachment-photo",
"nodes":[
{
"text": "Node1-1-2-1",
"ref": "sap-icon://attachment-text-file",
"nodes":[
{
"text": "Node1-1-2-1-1",
"ref": "sap-icon://attachment-video"
},
{
"text": "Node1-1-2-1-2",
"ref": "sap-icon://attachment-zip-file"
},
{
"text": "Node1-1-2-1-3",
"ref": "sap-icon://course-program"
}
]
}
]
}
]
},
{
"text": "Node1-2",
"ref": "sap-icon://create"
}
]
},
{
"text": "Node2",
"ref": "sap-icon://customer-financial-fact-sheet"
}
]
然后在树的“items”聚合中使用它。只要按照这种方式格式化 JSON 就可以了。重要的部分是:
[
{
"anyTextFieldYouWant": "Node1",
"nodes":
[
{
"anyTextFieldYouWant": "Node1-1"
},
{
"anyTextFieldYouWant": "Node1-2"
}
]
}
]
关于javascript - sap.m.树实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45367842/