Grid with combo box in only specific cells

I have a column in a grid that I want to use a select box with four values (1,2,3,4). Is there a way to only display the select box if a different column in the grid is filled in? For instance, if there are ten rows in the grid, but only two of them have a column filled in, I only want those two rows to display the combo box select with the (1,2,3,4).



Thanks!

Chava


There are two possible solutions:


1) the column type is coro, the options are defined for the column:


var combo = grid.getCombo(index)


combo.put(key1,value1);





combo.put(keyN,valuen);


But 8 from 10 rows have another type:





Or you can use setCellExcellType method to define cell type.


2) column type isn’t coro, but 2 cells in this column have coro type:


1some text here…

If I use setCellExcelType() to define a cell with type coro, how do I set the option list?


var combo = grid.getCustomCombo(rowId,columnIndex);


combo.put(key,value);


I am doing the following and it is not working:



grid.setCellExcellType(rowId, 10, “coro”);
         var c = grid.getCustomCombo(rowId, 10);        
         c.put(“A”, 1);
         c.put(“B”, 2);
         c.put(“C”, 3);
         c.put(“D”, 4);



Is there something else I need to be doing?



Thanks in advance.


The provided code looks correct. It should be called when row is loaded/added. In case of xml loading:


grid.loadXML(url,function(){


grid.setCellExcellType(rowId, 10, “coro”);
var c = grid.getCustomCombo(rowId, 10);
c.put(“A”, 1);
c.put(“B”, 2);
c.put(“C”, 3);
c.put(“D”, 4);



})


To change cell value you can use setValue method:


grid.cells(rowId, 10).setValue(“A”);


I am doing just that, I think, and it’s not working.  I am not seeing the combo box that is defined in the grid:



grid.load(myUrl, function () {        



myGrid.setCellExcellType(rowId, 10, “coro”);
         var c = myGrid.getCustomCombo(rowId, 10);        
         c.put(“A”, 1);
         c.put(“B”, 2);
         c.put(“C”, 3);
         c.put(“D”, 4);



}


Drop-down appears only in editing mode. When cell isn;t edited, you see cell value.


Please provide complete sample to recreate the problem if the editor type isn’t set.

gridDet.attachEvent(“onXLE”, function() {
gridDet.forEachRow(function(id){
combo = gridDet.cells(id,2).getCellCombo();
//combo.addOption(“id”,“value”); //you can use addOption instead of PUT
//For my script that each row has a question I passed the ID of each question with retrieve a XML content with a list of answers.
var pk_aval_per = gridDet.cells(id,3).getValue(); //ID of a question on column 3
combo.loadXML(“combo.Aval_Resp.php?pk=”+pk_aval_per+"&ncache="+ Date.parse(new Date()));
});
});