Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Satheesh Kumar K on Jul 24, 2008 11:12
open dhtmlx forum
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.
Answer posted by Support on Jul 25, 2008 02:36
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
    http://dhtmlx.com/docs/products/kb/index.shtml?cat=recent&q=4219
Answer posted on Aug 04, 2008 13:49

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.

Answer posted by Support on Aug 05, 2008 01:41

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.