views:

17

answers:

1

I need to dynamically generate a webpage UI using javascript and dojo. I need to listen to the generated widgets in order to react on user input, but I cannot determine which one was changed...

            var combobox = new dijit.form.ComboBox(
            {
                id: id,
                store: dataStore,
                onChange: dojo.hitch(this, this._comboChanged)
            });

In the call to _comboChanged I get the new value, but I also need to know which combo was pressed. There can be any numbers of combos and currently I store them in an array after creation.

A: 

You can pass the combo box itself to the comboChanged method:

var combobox = new dijit.form.ComboBox(
{
  id: id,
  store: dataStore
});
combobox.onChange = dojo.hitch(this, this._comboChanged, combobox);
kprevas