cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a tree which is expanded default?

Former Member
0 Kudos

Hi Gurus,

A tree(recursive) has been created with following structures. It is expected that all the tree leaves could be expanded initially when the tree appears. I can only show the 1st level NODES when the tree appears, but don't know how to show the LEAVES..

Any instructions? Thanks in advance.

TREE
   |__ NODE1
           |__ LEAF1
           |__ LEAF2
   |__ NODE2
           |__ LEAF3
   |__ NODE3
           |__ LEAF4

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check the expanded property of TreeNodeType to 'X'.

It will display ur tree with default nodes expanded to display the items.

Thanks and Regards,

Divya S

Former Member
0 Kudos

Hi both, firstly thanks for your replies.

But unfortunately, I think I had already done the same thing as instructed, while the tree still only shows to level NODES intially.

Design time :

TREE_ROOT (1..1)
    TREE_NODE (0..n)
        TREE_NODE_RECURSIVE (recursive of TREE_NODE)
        TREE_LEAF (0..n)

Run time:

TREE_ROOT
    NODE1 
        LEAF1
        LEAF2
    NODE2
        LEAF3
        LEAF4

I have ticked the EXPANDED flag in TreeNodeType.

In method WDDOINIT, firstly I added 2 elements under node TREE_NODE (which means there're 2 nodes: NODE1 & NODE2), and then I added 2 elements under NODE1 (which means there should be 2 leaves: LEAF1 & LEAF2), but finally the tree only shows NODE1 & NODE2. The leaves (LEAF1 & LEAF2) don't appear unless I mannually expanded NODE1.

Any steps missing? Many thanks...

Former Member
0 Kudos

It is still unsolved......

Any kind helps? Thanks in advance.

ChrisPaine
Active Contributor
0 Kudos

Have you tried binding the expanded attribute to a value in your bound context element - and then setting that as true - for both leaf and node?

Former Member
0 Kudos

Hi Chris,

As per my understanding, there's no EXPAND property in TreeItemType (the leaf). But I have ticked the EXPAND property in TreeNodeType (the node).

Just to mention, I'm using recursive tree. Does this matter?

ChrisPaine
Active Contributor
0 Kudos

Hi,

I've used recursive nodes in trees myself - and expanded them by default on load...

I never used the item type - just the node type - as I bound my recursive node structure to this.

Perhaps don't bother with Tree item type?

Former Member
0 Kudos

Hi,

Check this Web dynpro component: WDR_TEST_EVENTS. It has various examples on trees. I think it will be helpful.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try the following Web Dypro component: WDR_TEST_EVENTS. This has lot of examples on trees. It will be helpful.

Regards,

Saud

Former Member
0 Kudos

Hi Saud,

Thanks for the hint. But just noticed that NONE of the tree demos initially displays to the deepest leaf. All display only the 1st level nodes.

Former Member
0 Kudos

Solved.

Solution is: don't tick the EXPAND property in TreeNodeType, but bind the property to an attribute under the same context node of TreeNodeType, and set it as true for every element.

Thanks to everyone.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Fill the entire context in WDDOINIT and set expanded property of the TREE UIelement always to ABAP_TRUE or Checked