Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Steve Schreiner on Dec 04, 2008 07:39
open dhtmlx forum
select combo grid cell error

I basically copy a grid row and then try to select a cell in the newly created row. The cell Im trying to select and place in edit mode is a 'combo' type..

var newRowId = Math.ceil(Math.random()*10000000).toString();
ol_grid.addRow(newRowId,"");
ol_grid.copyRowContent(rowIdToCopyFrom, newRowId);
ol_grid.cells(newRowId,1).setValue(ol_grid.getRowsNum());
ol_grid.setCellExcellType(newRowId, ol_grid.getColIndexById('code'), "combo");
ol_grid.cells(newRowId,ol_grid.getColIndexById('code')).setValue("");
ol_grid.cells(newRowId,ol_grid.getColIndexById('quantity')).setValue("");
ol_grid.selectCell(ol_grid.getRowIndex(newRowId),ol_grid.getColIndexById('code'),true,false,true,true);

the select cell line errors out and gives me this message.

this.combo is undefined
detach()()dhtmlxgr..._combo.js (line 138)
editStop()(undefined)dhtmlxgrid.js (line 202)
onbeforeactivate()()dhtmlxgrid.js (line 365)
[Break on this error] this.cell.removeChild(this.combo.DOMParent);
Answer posted by Support on Dec 04, 2008 08:54
The problem mostly caused because of 
        ol_grid.setCellExcellType(newRowId, ol_grid.getColIndexById('code'), "combo");
While simple column types (co|coro) can be dynamically switched without any problems, the combo need to be configured ( list of options need to be set, before using such assignment )
Are you have combo object defined for column in question? ( can be configured through grid.getColumnCombo )


Also , the issue may occur if you have source row in edit mode while data coping . 
You can try to add
ol_grid.addRow(newRowId,""); 
ol_grid.stopEdit();
ol_grid.copyRowContent(rowIdToCopyFrom, newRowId);