Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Kathy on Jul 10, 2009 08:10
open dhtmlx forum
how can I enable drag and drop in subgrid?

I have grid with multiple subgrids. I need to be able to drag rows (change their order essentially) inside of each subgrid, but not between subgrids. How can I achieve that?
Answer posted by dhxSupport on Jul 10, 2009 08:38
You can include following lines at the sub grid configuration:
<head>
...
<beforeInit>
<call command="enableDragAndDrop">
<param>true</param>
</call>
</beforeInit>
</head>
Answer posted by Kathy on Jul 10, 2009 08:54
Thank you, but how can I prevent drag-and-drop between grids? I need rows to be draggable only inside their own grid.
Answer posted by dhxSupport on Jul 10, 2009 09:21
Answer posted by Kathy on Jul 10, 2009 09:34
I read the article. It probably answers my question by omission. Let me ask again - is there any property or parameter that I can use to make sure that drag-and-drop is only allowed inside of the grid, but not between grids? Or do I need to re-define "onDrag" even to block dropping in another grid? If I do need to redefine it, how can I do that for subgrids? Is there a way to do that in xml?


Answer posted by dhxSupport on Jul 13, 2009 07:00
The only way to disable drag-n-drop betwenn grid is to use "onDrag" event. 
Answer posted by Kathy on Jul 13, 2009 07:02
How can I attach "onDrag" handler to a sub grid?
Answer posted by dhxSupport on Jul 13, 2009 07:42

You can use "onSubGridCreated" event:

grid.attachEvent("onSubGridCreated",function(sub,id,ind,value){
sub.attachEvent("onDrag",function(){});
return true;
})