Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by chrisz on Apr 17, 2009 07:57
open dhtmlx forum
combo groups extension

Greetings & thank you for your great tools and great support via this KB.

I would like to create many pairs of dhtmlxCombo objects on a single page. Each pair should be tied together - basically using your 'groups extension' via "setAutoSubCombo". However this seems to display each pair in a stacked/vertical orientation. I would like to display them inline/horizontal:
combo1A - combo1B
combo2A - combo2B
combo3A - combo3B
One option I've tried is putting them in a table, and *not* using "setAutoSubCombo" - they each go into a separate cell. And then I tried to implement similar functionality myself. Of course when the event for combo1A is fired, I need a reference to combo1B...

Could you please tell me if any of the following options are possible?

1) Is there a way to use "setAutoSubCombo", but have the pair displayed inline/horizontal? (this way I don't have to separate them and write my own functionality)

2) Can I pass my own additional parameter (reference to 2nd combo) to the function called by the 1st combo's event? How?

3) I can figure out the "name" of the second combo by parsing the "name" of the 1st combo. Is something like the following pseudocode possible?:
eventFunction(){
var combo1_name = this.name
var combo2_name = parse(combo1_name)
var c2 = document.form.combo2_name
c2.loadXML("combo2_url.php?combo1_value="+this.value())
}

Again, thanks very much
Answer posted by Alex (support) on Apr 20, 2009 03:14

>> Is there a way to use "setAutoSubCombo", but have the pair displayed inline/horizontal?

It is possible only by attachChildCombo. The combos must be placed into table cells.

>> Can I pass my own additional parameter (reference to 2nd combo) to the function called by the 1st combo's event? How?

In this case it isn't possible to use group extension.

You can just use onChange event handler:

c1.attachEvent("onChange",function(){reloadCombo2()})

>> . Is something like the following pseudocode possible?

The combo object is one that you can get as follows:

var combo = new dhtmlXCombo(...);

To reload the 2nd combo the following can be used:

c2.loadXML("combo2_url.php?combo1_value="+c1.getActualValue());

Where c1 is parent combo, c2 - child combo.