Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by John W. Miller on Mar 13, 2008 04:10
open dhtmlx forum
Drag and Drop from Subgrid to main grid

I would like to know if it is possible to drag a row from the subgrid to main grid. Also is it possible to allow moving of the columns in the subgrid?
Answer posted by Support on Mar 13, 2008 07:52
Technically - subgrid is fully functional grid, so it possible to use any kind of API against it
You can get subgrid as
    var subgrid=grid.cells(i,j).getSubGrid();
and use any API calls against it
    subgrid.enableColumnMove(true);

Version of subgrid excell included in dhtmlxgrid 1.5 lack subgrid initialization events, so it may be hard to apply some modes - you can contact us directly ( at support@dhtlmx.com  ) if you need latest build.
Answer posted by John W. Miller on Mar 29, 2008 13:22

I tried your code and the call to get the subgrid is returning null. My subgrid is in the 4 column. Is the column zero based> I just received the latest build a coule of days ago, so I know I have the latest code. I would really appreciate any help in pointing me in the right direction on how to solve this.

Thanks

Answer posted by John W. Miller on Mar 29, 2008 13:54
Please disregard my last email. I figured out the problem.
Answer posted by Stanislav on Mar 29, 2008 14:48
The subgrid object became available only when relative subgrid created, it occurs only on opening of relative cell
You can try to use next code

grid.attachEvent("onSubGridCreated",functiond(sub){
    sub.enableColumnMove(true)
});
Answer posted by John W. Miller on Mar 30, 2008 08:07

I used your code suggestion and it worked great. I do have another question. I would like to enable the drag and drop from the subgrid to the parent grid. I tried to use subgrid.enableDragAndDrop(true) on both the parent grid and the subgrid. When I try to initialize the subgrid.enableDragAndDrop(true), the code will not work. Do you have any suggestions on what I may be doing wrong or what I need to code to get this to work?

Thank You,

John

Answer posted by John W. Miller on Mar 30, 2008 08:19
Please disregard my last posting, I was able to figure out my problem.