3

I am using the following example of SmartGWT :

http://www.smartclient.com/smartgwt/showcase/#tree_interaction_drag_nodes

And i want to disable dropping of any node on the root node. How do I do it?

Jama A.
  • 15,680
  • 10
  • 55
  • 88
Sagar Tandel
  • 299
  • 1
  • 3
  • 10

2 Answers2

2

I never did it but I will try with setCanAcceptDrop(false), for example:

TreeNode rootNode = new TreeNode();
    rootNode.setCanAcceptDrop(false);
    rootNode.setID("0");
    rootNode.setAttribute("Name","ROOT");       
    rootNode.setIcon("16/root.png");
    tree.setRoot(rootNode);
Alain BUFERNE
  • 2,016
  • 3
  • 26
  • 37
  • I suppose the SmartGWT takes the whole tree as root node in the example given..i just want to disable drop of nodes on **bin3** folder and allow dropping on blue green and yellow parts. – Sagar Tandel Feb 01 '12 at 11:13
  • Do you mean that when you get your bin3 node and setCanAcceptDrop to false it doesn't work? (Can you show piece of code) – Alain BUFERNE Feb 01 '12 at 14:01
  • The code is same as the code in example. I tried it as follows : `TreeNode rootNode = new PartsTreeNode("Root", new PartsTreeNode("Bin 3", new PartsTreeNode("Blue Part", "piece_blue.png"), new PartsTreeNode("Green Part", "piece_green.png"), new PartsTreeNode("Yellow Part", "piece_yellow.png") ) );` But its not working. The problem is it doesn't get added to any of the leaves too. And also the node that is dragged disappears after it is dropped. – Sagar Tandel Feb 01 '12 at 15:12
1

Use "setCanAcceptDroppedRecords(false)" command.