Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jay on May 20, 2009 00:35
open dhtmlx forum
Setting Default value in combo within DhtmlxGrid

How to set default value in combo within dhtmlx grid.I have done but not working sample is

var combo_discountBasisCd=deg_prddiscount.gridObj.getColumnCombo(deg_prddiscount.gridObj.getColIndexById('discountBasisCd'));
combo_discountBasisCd.addOption([['SUMASSURED','Sum assured'],['PREMIUM','Premium']]);
combo_discountBasisCd.setComboValue("SUMASSURED");

but in grid the default value is not set but without grid it works
Answer posted by Alex (support) on May 20, 2009 06:44
Hello,
in case of grid it is necessary to use grid methods to values:
...
grid.loadXML("some.xml",function(){
    grid.cells(row_id,cell_index).setValue("SUMASSURED");
})

If you want to set value for each cell in column:
...
grid.loadXML("some.xml",function(){
    grid.forEachRow(function(id){
        grid.cells(id,column_index).setValue("SUMASSURED");
    })
})