Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Helmut Frankenbach on Jan 21, 2010 04:49
open dhtmlx forum
grid.deleteColumn(cind) throws exception _cellType not defined

Hello

IE6: crash in "deleteColumn(cind)": exception in line 870 of dhtmlxgrid.js: "_cellType is null or not an object"
cells5:function(cell, type){var type = type||(cell._cellType...
Nevertheless: the column disappears from the Grid, but exception is strange and worries me.

The column was previously inserted dynamically after ajax call:
/**
* Insert a new column with the id given.
* @param id column id.
* @param colElementXML XML element with label,type,width,format.
* @param newColIndex insert the new column after this index.
*/
function insertColumn(id, colElementXML, newColIndex)
{
var label = colElementXML.firstChild.nodeValue;
var type = colElementXML.getAttribute("type");
var width = colElementXML.getAttribute("width");
var mask = colElementXML.getAttribute("format");
alert(id + "," + label + "," + type + "," + width);
bomGrid.insertColumn(newColIndex, label, type, width);
if (mask && mask.length > 0)
{
bomGrid.setNumberFormat(mask, newColIndex,"",".");
}
bomGrid.setColumnId(newColIndex, id);
}

Do you have any idea what could be the root cause for the exception. The column has no colspan, it is a normal column of type "edn" or "ron" (type is set in insertColumn).

Thanks and regards,
Helmut

Answer posted by Alex (support) on Jan 21, 2010 06:45

Hello

please check that you use the correct column index in the deleteColumn method.

If the problem isn't solved, please provide the sample to recreate it

Answer posted by Helmut Frankenbach on Jan 21, 2010 08:08

Column index is correct, the error occurs if deleting a column which was inserted in a loaded Grid with:

bomGrid.insertColumn(newColIndex, label, type, width);

bomGrid.setNumberFormat(mask, newColIndex,".",",");

bomGrid.setColumnId(newColIndex, id);

Later after user request:

var colNum = bomGrid.getColumnsNum();
for (var ccin = 0; ccin < colNum; ccin++) {
   var colId = bomGrid.getColumnId(ccin);
   if (colId && (colId.indexOf("YieldSize_") != -1)) {
       bomGrid.deleteColumn(ccin); // exception occurs
   }
}

Answer posted by Alex (support) on Jan 21, 2010 08:35
The provided code look correct. We need the complete sample to reproduce the issue (it can be sent to support@dhtmlx.com)