Categories | Question details Back To List | ||
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 = "<select><option>...</option></select>"; 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 Answer posted by dhxSupport on Apr 01, 2009 04:49 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 http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_excell_creation.html#grid_cexc Answer posted by Gaurav Arora on May 11, 2009 10:10 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. Answer posted by dhxSupport on May 12, 2009 06:09 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; }) Answer posted by Gaurav Arora on May 12, 2009 13:00 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? Answer posted on May 13, 2009 01:46 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 http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_excell_creation.html#grid_cexc Answer posted by Gaurav Arora on May 13, 2009 08:40 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 Answer posted on May 13, 2009 08:54 Unfortunately dhtmlxGrid hasn't appropriate method. |