Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Agile on Nov 01, 2008 02:54
open dhtmlx forum
Drag and Drop

Hi Team,

In my scenario I want to drag row from grid to tree.And in that case I want send ajax request to server and save data and update the grid and tree.How to do it?

And also drop event is enable only for some of nodes in tree.and drag and drop should be disable for grid within grid.
Please give me a help.

Thanks

-Agile
Answer posted by Support on Nov 03, 2008 01:39
Both grid and tree allow to set drag-n-drop event handlers.

For example, in order to manage drop from grid to tree, you can use tree's onDrop event handler:

grid = new dhtmlXGridObject(...);
....
tree=new dhtmlXTreeObject(...);
....
tree.attachEvent("onDrop",function(source_id,target_id,bef_id,source_object,target_object){

if(source_object == grid) /*your code here*/

})

In order to disable drop-and-drop you can use onDragIn event handler:

tree.attachEvent("onDragIn",function(sid,tid){
if(tid == "locked_id") 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
Also, please, see the article http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Managed_Drag_and_Drop.html