Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ravi on Jul 21, 2008 23:50
open dhtmlx forum
Drag and Drop in DHTMLXTreeGrid

Hi,
Two questions:

1) If you set the drag behavior, to complex, you can add a particular row as either a 'sibling' or 'child' of another row.

Is there a way, where I can allow this but a new tree cannot be formed on the fly. As in, I can drag a row to be a child of existing tree but cannot create a new tree structure on the fly.

I had hoped to achieve this functionality by the 'onBeforeDrag' handler. But, the only information that callback gives is that a source row is going to be positioned next to a destination row. It does not tells me whether the source row (dragged row) will be added as a sibling or as a child of the destination row.

2) Sometimes, after the drag and drop, the individual styles for the cells of dragged rows are lost. Is this a known issue or am I getting something wrong?

Thanks for all the good work,

-Ravi


Answer posted on Jul 22, 2008 02:07
>>the individual styles for the cells of dragged rows are lost
It is known issue in case of treegrid. Draged row preserve all main settings, but custom styles assigned to it may be lost while d-n-d

>>I had hoped to achieve this functionality by the 'onBeforeDrag' handler
You need to use onDrag event, it occurs exactly after item draged other target and mouse button released, but before any changes inside component done. Event handler will receive ID of source item and ID of target item, other details can be fetched from dragContext  object
    http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Managed_Drag_and_Drop.html#grid_mandnd