Deshabilitar la colocación en el nodo raíz en SmartGWT

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?

preguntado el 31 de enero de 12 a las 16:01

2 Respuestas

I never did it but I will try with setCanAcceptDrop(false), Por ejemplo:

TreeNode rootNode = new TreeNode();
    rootNode.setCanAcceptDrop(false);
    rootNode.setID("0");
    rootNode.setAttribute("Name","ROOT");       
    rootNode.setIcon("16/root.png");
    tree.setRoot(rootNode);

Respondido 01 Feb 12, 01:02

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

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

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

Use "setCanAcceptDroppedRecords(false)" command.

Respondido el 16 de junio de 15 a las 14:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.