Drag and Drop

I have two grids( Grid1 and Grid2) . I want to drag one row from first grid to second grid. Here is the scenario



Grid1



IDV

Resource1

Resource2





Grid 2



ProjectA

IDV

Resource 3

BOSS

Resorce 4



Now if i drag Resource1 and place it in on Project A row, it is not adding to group IDV under project A.Please provide me the sample code for the above explained example.

By default the row will be placed at the position where you drop it, there is no any built in logic for group preserving or similar behavior.
You can use onDrag event which receives all necessary info and change the desired destination of d-n-d operation
    dhtmlx.com/docs/products/kb/inde … ent&q=4219


I tried with the attachevent method , but it seems that attachevent method is not even triggered.



Here is the peice of code i used.



 mygrid3.init();
   
 //mygrid3.splitAt(1);
 mygrid3.enableHeaderMenu();



mygrid3.attachEvent(“onDrop”,function(sid,tid,nid,sgrid,tgrid){
    //sid - id of draged row in source grid
    //tid - id of target row
    //nid - new id of draged  row, which was assigned in target grid
    alert(“In Drop”);
    tgrid.changeRowId(nid, “13554~test~nb787” );
        });



 



Please help me on this.


The code which you are using is correct. Please be sure that onDrop method was attached to “target” grid.


Working sample with the same js code sent by email.