开发者

Listen to a dynamic number of dojo widgets (dijits)

I need to dynamically generate a web page 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 stor开发者_JAVA百科e them in an array after creation.


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜