Can't load dhtmlxcombo in grid

Hi,

I’m trying to load options into a DHTMLX combo cell embedded in a DHTMLX grid, and load it through JavaScript.

I have the following code:

           var comboStreet = mygrid.cells(rowId,colIdx).getCellCombo();
           comboStreet.clearAll();
           comboStreet.addOption("1","Ash Street");
           comboStreet.addOption("2","Baker Street");

. . .

But the cell doesn’t load.

I have DHTMLX professional version v3.5, and I’m using the following grid/combo/excell libraries:

	<script src='./dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js'></script>
	<script src='./dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js'></script> 
	<script src='./dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js'></script>
	<script src='./dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.js'></script>			
	<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_validation.js'></script>
	<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_json.js'></script> 		
	<script src='./dhtmlx/dhtmlxGrid/samples/common/data.js'></script>
	<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js'></script>
	<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js'></script>
	<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_form.js'></script>
	<script src='./dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_combo.js'>

Please help? Thanks.

Hi
It seems to me that you try to do this in time, when options aren’t loaded.
Do it in a callback function of xml loading:

mygrid.loadXML("grid.xml", loadingOptionToCombos()); ... function loadingOptionToCombos(){ var comboStreet = mygrid.cells(rowId,colIdx).getCellCombo(); comboStreet.clearAll(); comboStreet.addOption("1","Ash Street"); comboStreet.addOption("2","Baker Street"); }
Or in onXLE event handler:
docs.dhtmlx.com/doku.php?id=dhtm … nt_onxle&s[]=onXLE

Hi, Darya,

Thanks very much, I’ll try out your ideas!

You are welcome!

Hi again,

I have another question, please. Is it possible to capture an ‘onkey’ (up/down/press) event within a a grid excell combo cell? I’ve tried code like this:

mygrid.attachEvent(“onEditCell”,function(stage,rowId,cInd){
if(stage==1 && cInd==5){
mygrid.editor.obj.onkeyup = function() {
alert(“You pressed a key!”);
. . .

… but the code only works if the cell is defined as “ed” using the setColTypes method. It doesn’t work if it’s defined as “combo”.

Thanks very much!

Hi
You need to get input objext
Try the next way:
grid.getCombo(col_ind).DOMelem_input.onkeyup = …