cancel
Showing results for 
Search instead for 
Did you mean: 

Drop on tree node

faebulicious
Explorer
0 Kudos

hi

i want to enable drag 'n' drop for a tree. it works mostly as expected, but it it is not possible to drop a node on another node which has no children. to make this possible, i had to set has_children to true for every node, even if the node has no children. this makes the expander showing up, which is quiet ugly.

is there another way to drop on a node without any children (like in sapgui tree)?

thx

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

Hi Fabian,

I just set up a simple scenario on my system and the state of the has_children flag made no difference - I could still use any node that was configured as a drop target for one of the other nodes - child or not.

I'm running 7.01 SP5 - so not the latest!

I'd check that there isn't somehow some accidental link between your tags and the is child flag perhaps?

Cheers,

Chris

faebulicious
Explorer
0 Kudos

Thx for your reply

The tags are fine, since every node has the same tags. i have 7.01 SP3, maybe its a bug...

ChrisPaine
Active Contributor
0 Kudos

Check out SAP Note:

[Note 1386949 - WD ABAP: Drag & Drop in Trees with several TreeNodeTypes|https://service.sap.com/sap/support/notes/1386949]

and the associated:

[Note 1298115 - WD ABAP: Selecting tree node may not clear old selection|https://service.sap.com/sap/support/notes/1298115]

N..B SMP login required for links above.

comes in in 7.01 SP4 - think you might need it... Could be the difference between it working on my system and not on yours...

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

If you described situation is right, i do think that you can modify the Context Node of Tree dynamically.

How to do it?

You know, the tree node has one property named "has children". So, i think you can add one attribute to your context node, and bind it with this property.

Then, you can use your Drag&Drop event, in which you can get so many parameters,such as 'ID','INDEX','Offset' ,etc. And i think you can make use of these parameters to get the the context element if necessary.

Then, you can set the context attribute of your drop-target tree node's element dynamically.

At the same time, i think you need clear the Drag-source tree node's "Has children" attribute if necessary.

I don't know whether it can work fine, i just wrote what i thought out about your post.You can check, hope it can help you a little a little.

Best wishes.

faebulicious
Explorer
0 Kudos

hi

thanks for your reply. i can handle all the context stuff (attributes has_children, expanded) the right way. it is all working fine. the problem is more a usability problem. when i start dragging a node, the node where i like to drop it is highlighted when its a node, which has children. when it is a node without chlidren the node is not highlighted an i only can drop it before and after (a line is display before and after) the node.

i know how to handle the different attributes (like offset) but for the user this is not clear. if he wants to drop on a node, the node has to be highlighted.

thx