Categories | Question details Back To List | ||
Enable drag from grid Hi Team, I want to enable only drag functionality in grid and not drop? and In tree only allow drop functionality and not drag. How to do it? Thanks -Agile Answer posted by Support on Nov 03, 2008 01:44 Please, see the article http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Managed_Drag_and_Drop.html You can try to use onDrag event handler: grid.attachEvent("onDrag",function(sid,tid,bid,sobj,tobj){ if(tobj == grid) return false return true }) tree.attachEvent("onDrag",function(sid,tid,bid,sobj,tobj){ if(sobj == tree) return false return true }) grid.attachEvent("onDragIn",function(sid,tid,sobj,tobj){ if(tobj == grid) return false return true }) The full list of events can be found in the documentaiton: dhtmlxGrid/doc/events.html dhtmlxTree/doc/events.html Answer posted by Michael on Dec 05, 2008 09:52 Based on your code example, how do I actually determine if it is a "grid"? When I break into debug mode in JavaScript and show my locals variables, I do not see a "type" property or anything similiar that I could use to determine if tobj == grid. grid.attachEvent("onDragIn",function(sid,tid,sobj,tobj){ if(tobj == grid) return false return true }) Answer posted by Michael on Dec 05, 2008 11:41 when dragging into the grid I see a dragContext.source and dragContext.target that I can use, but when I drag from tree to tree I do not get that property. Answer posted by Support on Dec 09, 2008 02:14 >>Based on your code example, how do I actually determine if it is a "grid"? The sobj and tobj are references to the component objects, you can compare them with known instances of tree grid.attachEvent("onDragIn",function(sid,tid,sobj,tobj){ if(tobj == grid) return false here grid is no a some special name - but real variable used for storign reference of grid object. >> I do not see a "type" property or anything similiar that I could use to determine if tobj == grid. Its not part of public api, but you can use if (tobj.mytype=="tree") action_for_tree(); else action_for_grid(); >>when dragging into the grid I see a dragContext dragContext is a grid specific object, there is no such object available for d-n-d operation in tree. |