Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by DATASEC on Apr 01, 2008 03:19
open dhtmlx forum
Coordinates / size of a specific cell

Hi,

thank you for dhtmlxGrid. It's such a great component.

What we're trying to do at the moment is to display a small link right of the actual cell.

Is there a posibility to get the exact coordinates of a specific cell (maybe the actual cell) and as well the width and the height for positioning a div layer next to the cell?

Is there a chance to get the exact coordinates in relation to the entire page?


Thank you for your help.

DATASEC
Answer posted by Support on Apr 01, 2008 05:59
The HTML element of currently selected cell can be taken as
    mygrid.cell
if you need to get some cell by coordinates , it may be done as
    mygrid.cells(i,j).cell

In such case its dimension can be taken as
    mygrid.cell.offsetWidth
    mygrid.cell.offsetHeight

There is no direct property to take cell coordinates, but grid has private functionality for such purpose

    var pos=grid.getPosition(grid.cell);
    or
    var pos=grid.getPosition(mygrid.cells(i,j).cell);

The pos is an array
    pos[0] - x position relative to document.body
    pos[1] - y position relative to document.body
Answer posted by DATASEC on Apr 13, 2008 05:40
Hi,

thank you very much for this excellent answer. It worked great!

DATASEC