get selected cell value in another tab


#1

I was just wondering if there is a way to retrieve a grid’s cell value in another tab. The tabs are all iframes-on-demand.

Basically, what I have is a page where a user performs a search for a member. The search results are displayed in a grid.

The user can then double click on a row in the grid and that takes them to another tab, which has nested tabs (iframes-on-demand as well). I need to retrieve the cell value of the selected row so I can display correct information.

Thanks in advance.


#2

you can get the value of a needed cell using:
val=mygrid.cells(rowId,colInd).getValue() method.

To find the attributes of the selected cell tyou may use:
mygrid.attachEvent(“onRowSelect”, function(id,ind){});

To find the attributes of the editing cell:
docs.dhtmlx.com/doku.php?id=dhtm … oneditcell


#3

This doesn’t work. Neither onRowSelect nor onBeforeSelect are triggered when a cell is selected. What event can be used to know which cell has been clicked?

   g_tgrid = cellB.attachGrid();
   g_tgrid.load('res/config/timesheetGrid.xml');
   g_tgrid.setImagesPath("res/lib/dhtmlx/imgs/dhxgrid_material/");
   g_tgrid.enableDragAndDrop(true);
   g_tgrid.enableRowsHover(true,"gridHover");
   g_tgrid.enableMarkedCells();
   g_tgrid.enableEditTabOnly(true);
   g_tgrid.init();
   g_tgrid.attachEvent("onBeforeSelect",function(nid,oid,ind){ alert(g_tgrid.cells(nid,ind).getValue()) })
   g_tgrid.attachEvent("onRowSelect",function(id,ind){ alert(g_tgrid.cells(id,ind).getValue()) })

This is a really stupid solution, but it’s the only one that works:

document.getElementsByClassName("cellselected")

Something better needs to be provided.

Edit: I found this, which is some of the functionality, but there’s still no event for selecting a cell listed in the public API unless it isn’t named very well.


#4

In case of using the cell marking only the onCellMarked/onCellUnmarked evenrts can be used:
https://docs.dhtmlx.com/api__dhtmlxgrid_oncellmarked_event.html
https://docs.dhtmlx.com/api__dhtmlxgrid_oncellunmarked_event.html
Pleas,e note, that in case of marking the cells actual selecting is not working:
https://docs.dhtmlx.com/grid__selection.html#alternativeselection

Note, API related to the default selection can’t be used with the alternative types (as alternative types are not really a selection, they are just marking.