I recently discovered a trouble while using drag & drop between grids, when trying to get the source column. Maybe I did something wrong, but I can’t see what.
I have two basic grids initialised exactly the same way.
function initGrid(pContainer){
var tmpGrid = new dhtmlXGridObject(pContainer);
tmpGrid.setImagePath("./codebase/imgs/");
tmpGrid.setHeader("Column 0, Column 1");
tmpGrid.setInitWidths("100,*");
tmpGrid.enableDragAndDrop(true);
tmpGrid.enableMercyDrag(true);
tmpGrid.init();
tmpGrid.setSkin("dhx_skyblue");//set grid skin
for(var i=0;i<10;i++){
tmpGrid.addRow(i,["cell_"+i+"_0","cell_"+i+"_1"]);
}
return tmpGrid;
}
In my code, I have a very basic event to see what’s happening :
var tmpGrid1 = initGrid("CONTAINER_GRID1");
var tmpGrid2 = initGrid("CONTAINER_GRID2");
tmpGrid2.attachEvent("onDrop",
function(sId,tId,dId,sObj,tObj,sCol,tCol){
console.log("[GRID2] Source="+sCol);
}
);
When dragging from grid 1 column 0, I can get “0”, “1”, or even “undefined” as “sCol” parameter, without any logic nor regularity.
Has anyone an idea?
My main goal is if I drag from column 0, the line is copied (basic mercyDrag), but from any other column I just copy the source cell content into the destination cell.
Unfortunately the issue still cannot be reproduced locally.
Your code works well for us.
Please, try to update your dhtmlx.
If issue still occurs for you - please, provide with a complete demo, where the issue can be reconstructed.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan