on 2020 Jan 14 4:18 PM
We have a project where we need to list a hierarchy of messages, and thought sap.m.Tree would be a good candidate for the job. But when loading the data, which is a nested object, we found out that it renders a node for all objects. In out data set To, From, and MessageDate is objects, and those are responsible for the empty nodes in my example. Since this behaviour is present in all recent versions of UI5, we assume this is by design.
Why is this happening? And is there a way to prevent this, or will I have to find another solution for my example? I have searched the docs, and looked into the lib source code, but haven't found any clues.
A live example can be found on Plunker, at https://next.plnkr.co/edit/Qa0vWsHlDrjAzHRq
Request clarification before answering.
You can specify the arrays that should be displayed by the tree. By default, all arrays are displayed as nodes, I guess the table also displays each entry from the "features" array as its own node, but these object do not match the binding templates, hence the empty nodes. You are looking for the parameter arrayNames from JSONTreeBinding.
Try this as your binding syntax:
items="{path: '/features', parameters: {arrayNames: ['nodes']}}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are magnificent Nicolas!
This was the piece of information I was missing, Thank you for guiding me towards the right solution, and referring to the documentation. It's easy to get lost sometimes. ☺️
User | Count |
---|---|
89 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.