Check documentation for the latest version of dhtmlxSuite Grouping Combos DHTMLX Docs

Grouping Combos

Starting from version 4.0 the methods attachChildCombo() and setAutoSubCombo() have been deprecated. Now users have the possibility to group combos by themselves. The new variant of grouping is more extended. It allows you to define the conditions under which child-combos are hidden of disabled.





The code snippet below creates the variant of grouping combos presented in the picture above:

// init master combo
myCombo = new dhtmlXCombo("combo_zone", "combo", 230);
myCombo.load("combo_group.php?mode=state");
myCombo.enableFilteringMode(true);
 
// init slave combo
myCombo2 = new dhtmlXCombo("combo_zone2", "combo2", 230);
myCombo2.enableFilteringMode(true);
myCombo2.disable(); // disable on init
 
// grouping logic
 
// we will enable and reload slave combo
// if any not-empty value is selected in master combo,
// and disable and clear slave combo
// if value not selected in master
myCombo.attachEvent("onChange", function(value){
    myCombo2.clearAll();
    myCombo2.setComboValue(null);
    myCombo2.setComboText("");
    if (value == null) {
        myCombo2.disable();
    } else {
        myCombo2.enable();
        myCombo2.load("combo_group.php?state="+value);
    }
});
Back to top