Skip to Content
0
Former Member
Mar 01, 2013 at 01:52 AM

SAPUI5 Tree control loading

227 Views

HI All,

Does anyone know if it is possible to instantiate and load a Tree control without first having to individually create all the nodes seperately setting their relationships each time?

Basially I'd like to be able to map an XML structure into a Tree control without first having to programatically pull it apart in order to create nodes.

There doesn't seem to be anything in the documentation.

Can I use aggregation somehow to perform this? This would seem to be the way that Table controls are created and filled.

So if I have some simple XML:

<?xml version="1.0"?>

<tree>

<branch>

<id>1</id>

<name>Root Branch</name>

<parentId>0</parentId>

</branch>

<branch>

<id>2</id>

<name>First Branch</name>

<parentId>1</parentId>

</branch>

<branch>

<id>3</id>

<name>Second Branch</name>

<parentId>1</parentId>

</branch>

<branch>

<id>4</id>

<name>First Sub Branch</name>

<parentId>2</parentId>

</branch>

</tree>

How can I read this in and create the interlinked nodes and Tree control that looks like:

Regards

Marty

Attachments

tree.gif (1.9 kB)