dhtmlxGrid getChangedRows()

Hi,



I am using a grid in which one of the columns is a custom dropdown which is created by setting the innerHTML of the cells as follows…

grid.cellById(…).cell.innerHTML = “…”;



If I change a value in this dropdown for a row and call getRowsChanged() function, it doesn’t return the row id.



Please suggest on how to handle this situation.



Thanks,

Gaurav Arora

Inner html of the cell doesn’t impact to the grid. To can set “onchange” event to the selectbox and call mygrid.cells(id,ind).cell.wasChanged=true; to mark ceratain cell as changed. Or you can implement custom excell type. Please see more information here dhtmlx.com/docs/products/dhtmlxG … #grid_cexc

If I have multiple grids on a page with each grid having a column of dropdowns created by setting innerHTML of the cells, how can I get the grid object to which the dropdown, for which a value is being changed, belongs.

In other words, I want to set an onChange event for each of the dropdowns so that I can mark the row dirty as explained in the previous answer. But for that I need to know the grid to which the dropdown belongs. How can I get a handle to the grid to which my dropdown belongs? This will be required in case I have multiple grids on the page.

You can attach “onEditCell” event to the each grid. Inside event handler “this” pointer will refer to the grid object which was fired event.
mygrid.attachEvent(“onEditCell”, function(stage,rowId,cellIndex){
if (stage==2){
this.setRowTextStyle(rowId,cellIndex,“font-size: bold”);
}
return true;
})

The cell in which I have the dropdown (created by setting innerHTML) is not editable. How can I get a handle to the container grid for that cell’s dropdown in the onChange event?

If you insert custom html to the cell with type “ro”, changing that html doesn’t call “onEditCell” event. That’s wy grid doesn’t understand that value in the cell was changed. If you need some complex html in the cell and you want catch “onEditCell” or “onChange” events on that cell you should implement custom eXcell type. You can find more information here dhtmlx.com/docs/products/dhtmlxG … #grid_cexc

A simple final question…

Is it possible for me to get the grid object (by calling an API) in which I have a cell selected. I do not want to fire any events.

Gaurav

Unfortunately dhtmlxGrid hasn’t appropriate method.