Problems after TreeView upgrade

Hi,



I recently upgraded from treeview 1.3 pro to the latest version (2.1 pro) after buying a new enterprise licence. However, when dragging and dropping a node it is now very slow - so much that it is unusable.



I have a drag handler method which executes server side code via AJAX and returns false so that the drag is not performed, as it may not be allowable depending on the result of the AJAX request. The callback method will process the result and then perform the move if allowed and I believe this is where it is failing. This is my code for the callback method which previously worked fine in 1.3:



    //remove drag handler as we are already processing drag n drop

    tree1.attachEvent(“onDrag”, null);

    tree2.attachEvent(“onDrag”, null);



    //perform the move

    tree1.moveItem(id, ‘item_child’, parentId, tree1);

    tree2.moveItem(id, ‘item_child’, parentId, tree2);



    tree1.sortTree(parentId, ‘ASC’, ‘false’);

    tree2.sortTree(parentId, ‘ASC’, ‘false’);



    //add drag handler back to tree

    tree1.attachEvent(“onDrag”, treeDrag);

    tree2.attachEvent(“onDrag”, treeDrag);



The only change is that instead of using setDragHandler, I now use the attachEvent method. I previously had

    tree1.setDragHandler = null;



I also have a problem that the onRightClick event handler shows the standard context menu (i.e. windows context menu) whenever I right click a node, but i want this menu not to show and my own one to show. This also worked fine before the upgrade.



Any help is much appreciated



-Calum


Hello,


attachEvent method returns the event hnadler id that can be used for detaching event handler:


var ondragid = tree.attachEvent(“onDrag”,someFunction);


tree.detachEvent(ondragid);


There are two possible ways to disable appearing of the standard context menu on right click:


1) the second parameter of the onRightClick event handler is event object you can use it to disable the standard context menu;


2) dhtmlxEvent(tree.allTree,“contextmenu”,function(e){ (e||event).cancelBubble=true;return false; }); where tree is tree object.