Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by tep on Sep 09, 2008 18:07
open dhtmlx forum
getting the id of the grid object in setDragHandler

Hi,

im trying to retrieve the id of the source grid in the setDragHandler method..

in the documentation a function inside the setDragHandler is automatically created..something like function(sid, tid, sgrid, tgrid, colStart, colEnd),
so to use setDragHandler is something like this:

altDestBox.setDragHandler(function(sid, tid, sgrid, tgrid, colStart, colEnd)
{
    //some code..
});

the question is how do i get the id of the source grid..as i understand it the sgrid returns the object source grid..but what i need to get is the id of the source grid..

for example i have 3 grids in my page, and they are all set to enableDragAndDrop(true), how do i know the source of a drag..example i drag an item in grid1 to grid2 to.. in the setDragHandler of grid2 how do i know that its from grid1 and not from grid3 or any other grid?

thanks..for the help..
Answer posted by Support on Sep 10, 2008 02:04
>>.but what i need to get is the id of the source grid..
ID of grid's container
      sgrid.entBox.id


>>how do i know that its from grid1 and not from grid3 or any other grid?

var grid1 = new dhtmlXGridObject(...
var grid2 = new dhtmlXGridObject(...
var grid3 = new dhtmlXGridObject(...

grid2.setDragHandler(function(sid, tid, sgrid, tgrid, colStart, colEnd) 

      if (sgrid == grid1) alert("data from grid1");
      if (sgrid == grid3) alert("data from grid3");
      ...
});