Categories | Question details Back To List | ||
2 Trees + Connector_PHP - prevent drag on connector tree? I have an app where I drag a list of xml_generated documents from one container to a second container-- a connector_php tree of categories. I would like documents to be dragged anywhere,in any container, but have the categories be fixed (no drag, but category can be dropped on). I've added a db field "nodrag" = true, but don't know how to render this in the connector so it displays on the site as UserData. Then I would use a custom function to prevent drag of these UserData items. Here's the general idea: tree.attachEvent("onBeforeDrag",function(){ var testdnd = tree.getUserData(id,"nodrag").value; if (testdnd = "true") {return false;} else {return true;} }); Any ideas on how to solve? // the connector_php code// function no_dragging_categories($data){ if ($data->get_value("nodrag") = "true") add the tag "<userdata name='nodrag'>true</userdata>"; } $tree = new TreeConnector($res); $tree->event->attach("beforeRender","no_dragging_categories"); $tree->render_table("CATEGORYLIST","taskId","taskName","","parentId"); // the html code// ... //--CATEGORIES TREE - RHS --// tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); tree.setImagePath("../dhtmlxSuite/dhtmlxTree/codebase/imgs/"); tree.enableDragAndDrop(true,false); tree.attachEvent("onDblClick",function(id){document.location.href=tree.getUserData(id,"url");return true;}); tree.loadXML("get-categories.php"); //need to make this trees elements not draggable - use userdata //--DOCUMENTS TREE - LHS --// tree2=new dhtmlXTreeObject("treeboxbox_tree2","100%","100%",0); tree2.setImagePath("../dhtmlxSuite/dhtmlxTree/codebase/imgs/"); tree2.enableDragAndDrop(true); tree2.makeAllDraggable(); tree2.attachEvent("onDblClick",function(id){document.location.href=tree2.getUserData(id,"url");return true;}); tree2.loadXML("get-docs.php"); //--PREVENT DRAGS AND DROPS ONTO DOCUMENTS TREE --// function no_drag_to_docs(id_drag, id_landing) {return false;} tree2.setOnDragIn(no_drag_to_docs); //--PREVENT MOVING CATEGORIES, allow documents dnd here only --// tree.attachEvent("onBeforeDrag",function(id){ var testdnd = tree.getUserData(id,"nodrag").value; doLog(testdnd); if (testdnd = "true") {return false;} else {return true;} }); Answer posted by Alex (support) on Oct 28, 2009 06:13 beforeRender handler can be as follows: function no_dragging_categories($data){ |