DHTMLX Docs & Samples Explorer

Groups extension

Groups extension allows to organize groups of combos with parent-child dependence, when options of child combos are determined by the value of selected option in its parent. Method attachChildCombo(child_combo,url) defines a child combo and sets a path to a server-side script which generates a necessary xml.

    var z2=new dhtmlXCombo("combo_zone2","alfa2",200);
 
    var z=new dhtmlXCombo("combo_zone","alfa1",200);
    z.enableFilteringMode(true);
    z.attachChildCombo(z2,"combo2.php");
    z.loadXML("combo1.xml");
 

When some option is selected in the parent combo, the server-side script (“combo2.php” in the example above) receives the value of this option with the request; the name of this parameter is “parent”. Such a functionality allows to form xml stream depending on parent's value using any server-side language.

    combo2.php?parent=PARENT_VALUE
 

Child combos can be set in the same container with their parent using setAutoSubCombo(url,name). In this case, they inherit all methods and properties of the parent, except the server-side script and the name which are set in the setAutoSubCombo method.

    var z1=new dhtmlXCombo("combo_zone1","alfa1",200);
      z1.enableFilteringMode(true);
    z1.loadXML("combo1.xml")  
    var z2 =  z1.setAutoSubCombo("combo2.php","alpha2")
    var z3 =  z2.setAutoSubCombo("combo3.php","alpha3")
 

© Dinamenta, UAB