Refresh datas in Combo

Hello,

i 've a dhtmlxgrid with 4 columns. The first two column types are ‘ed’ the third and fourth column types are ‘combo’.
If the user change an entry in the combo of third column the datas in the last combo should be updated and refreshed. My code:

mygrid = new dhtmlXGridObject(‘mygrid_container’);
mygrid.setColTypes(“ed,ed,combo,combo”);
(…)
mygrid.init();

dp = new dataProcessor(…);
(…)
dp.init(mygrid);

(…)
combo.attachEvent(“onSelectionChange”, function()
{ …load datas from a database…
});

When datas are loaded:
var combo = mygrid.getCustomCombo(mygrid.getSelectedRowId(),3);
combo.clear();
combo.put(…);

I see the datas come in the combo but the view in mygrid will not refresh.
Why?

Kind regards, Carsten

Hello,

you can not apply getCustomCombo for the “combo” type (only to “co” and “coro”). Also dhtmlxcombo doesn’t support clear() and put() method,

You may use the following instead:

var combo = mygrid.cells(mygrid.getSelectedRowId(),3).getCellCombo();
combo.clearAll();
combo.addOption([[“value1”,“text1”],[“value2”,“text2”],[“valueN”,“textN”]]);

Hello Alexandra,

many thanks for your answer, i will try it.
But please have a look here in this documentation:
docs.dhtmlx.com/doku.php?id=dhtm … ustomcombo

Here you can read:
(…)
Note cell must have “co”, “coro” or “combo” type

Regards, Carsten

Ok, it works nearly. The entries in Combo are updated but not the entry in the cell. Here i still read the last selected entry. :confused:

Push

Hello,

there was a mistake in the documentation.

To set new cell value you need use setValue(value) method:

var combo = mygrid.cells(mygrid.getSelectedRowId(),3).getCellCombo();
combo.clearAll();
combo.addOption([[“value1”,“text1”],[“value2”,“text2”],[“valueN”,“textN”]]);

mygrid.cells(mygrid.getSelectedRowId(),3).setValue(“value1”);