Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by chrisz on May 26, 2009 14:06
open dhtmlx forum
Combo group in grid

Is it possible to create a combobox group (eg: attachChildCombo()) with both comboboxes inside a grid? If this is not possible, can it be done by attaching events manually?
Would you please provide an example of whichever method is possible?

Thank you very much
Answer posted by Alex (support) on May 27, 2009 05:27

Hello, 

attachChildCombo can't be used in case of combo excell. 

Similar functionality can be achieved using onEditCell event handler - when the editor is closed (the value is changed in one combo), you can reload the other one:

grid.attachEvent("onEditCell",function(stage,row_id,cell_index){

if(stage == 2 && cell_index == parent_index){

var value = grid.cells(row_id,cell_index).getValue(); /*new value in parent combo*/

var child_combo = grid.cells(row_id,child_index).getCellCombo(); /*object of the child combo in the row*/

child_combo.loadXML(some_script+"?parent="+value); 

}

return true

})

Here child_index is index of the column with child combos, parent_index - with parent combos.