changecelltype problem

Hi

Im having trouble with the changeCellType method.

The documentation is inconsistent/wrong and I can’t get it to work.
I want to change the cell type of every cell in row 0 to be a select list. - just on row zero.

Has anyone done this before ?

My code fragment is a simple loop.

[code] for (var i = 1 ; i < colCount ; i++){
importGrid.changeCellType(importGrid.getRowId(0),i,“co”); // tried this way
importGrid.changeCellType(0,i,“co”); // and also this way

	}

[/code]

it generates an error:

TypeError: g.childNodes is undefined

…his.cells4(a)},cells3:function(g,c){var a=(g._childIndexes?g.childNodes[g._child…
dhtmlx.js (line 9, col 772596)

Be sure that you are using the above code after data loading ( data loading is async, so you need to use onXLE event or callback of load command )

Also, beware that the above code will create a line with select like editors, but they will be visible only after dbl-clicking on related cell, it will not be a line of visible selects.

Hi Stanislav

I am using the parse method which is synchronous. I have checked that the rows are loaded before it tries to set the cell type. Here is the whole function.

[code] function loadGrid(d){
var firstLine = d.substring(0,d.indexOf(’\n’));
d = d.replace(/\r/gm,’\n’);
var data = d.substring(d.indexOf(’\n’));
var colCount = firstLine.split(",").length - 1;
importGrid.setHeader(firstLine);
importGrid.setColumnIds(firstLine);
importGrid.init();
importGrid.clearAll();
importGrid.parse(data,“csv”);
consoleLog("processing " + importGrid.getRowsNum())
for (var i = 1 ; i < colCount ; i++){
importGrid.changeCellType(importGrid.getRowId(0),i,“co”);
}
importGrid.setRowColor(importGrid.getRowId(0),“yellow”);
importToolbar.setProgressOff(“upload”);

}

[/code]

Change
importGrid.changeCellType(importGrid.getRowId(0),i,“co”);

To
importGrid.setCellExcellType(mygrid.getRowId(0),i,“co”);