dhtmlx combobox dynamic populating in Grid

Hello,
I am a user of the pro version and was wondering about the dhtmlx combobox inside of a grid. I have been unsuccessful in dynamically populating data in the dhtmlx combo box based on the value from another cell. I was able to do this with the mygrid.put(value,description) when using coro excell, but not when using the combo excell type. I tried to use the API method "addOption() for dhtmlxCombo, but I am getting “not a function” in firefox and “object doesn’t support this property or method” in IE. Is it not possible to add options dynamically to the dhtmlx combobox after the grid is loaded? if it is possible, can you please let me know what I have to do?

Thanks

I tried to use the API method "addOption() for dhtmlxCombo, but I am getting “not a function” in firefox and “object doesn’t support this property or method” in IE

This issue may occur of you have not attached dhtmlxCombo/codebase/dhtmlxcombo.js file.

I have included all necessary combo files for the combo box (or so I thought):
…/codebase/dhtmlxcombo.js
…/codebase/excells/dhtmlxgrid_excell_combo.js

will “addOption()” work inside of a grid? below is my code to get the combo box and add an option to it, which does not work. I get xml back correctly, but nothing appears in drop down and I get the error described previously.

var combo = mygrid.getCustomCombo(rId,cInd);
combo.addOption(value,displaytext);

Thanks for your help on this.

Please contact directly customer.support@dhtmlx.com and we will provide you working example.

Morning!

The following code produces no errors, but also has no results in the new column that is created.

Can you post the solution to this problem in the forum as well?

Thanks!

Will.

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Tables</title>
</head>

<link rel="stylesheet" type="text/css" href="../../dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css">
	
<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/dhtmlxGrid/codebase/ext/dhtmlxgrid_mcol.js"></script>
<script src="../../dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.js"></script>

<script>
var gridData = '<?xml version="1.0" encoding="UTF-8"?><rows><row><cell>Alpha</cell><cell>www.google.ca</cell></row><row><cell>Bravo</cell><cell>www.bing.com</cell></row><row><cell>Charlie</cell><cell>www.yahoo.ca</cell></row><row><cell>Delta</cell><cell>www.ibm.ca</cell></row></rows>';

var mygrid;
function doInitGrid(){
	mygrid = new dhtmlXGridObject('mygrid_container');
	mygrid.setImagePath("../../dhtmlx/dhtmlxGrid/codebase/imgs/");
	mygrid.setHeader("Name,URL");
	mygrid.setInitWidths("150,150");
	mygrid.setColAlign("center,center");
	mygrid.setColSorting("str,str");
	mygrid.setColTypes("ro,ro");
	mygrid.setSkin("light");
	mygrid.init();
	mygrid.parse(gridData);
			
	mygrid.insertColumn(0,"Action","coro",150);
	var combo = mygrid.getCustomCombo(1,0);
	combo.put("A","1");
	combo.put("B","2");
	combo.put("C","3");
}
</script>
    
<body onload="doInitGrid();">
<table>
<tr>
<td><div id="mygrid_container" style="height:600px;"></div></td>
</tr>
</table>
	
</body>

</html>

Found a working solution:

  1. Changed the code that added and populated the new combo column to:
mygrid.insertColumn(0,"Action","combo",150);

var combo = mygrid.cells(1,0).getCellCombo();
combo.addOption("A","1");
combo.addOption("B","2");
combo.addOption("C","3");
  1. Added dhtmlxcombo.css

Hope this helps…

Will.