开发者

Listen to a dynamic number of dojo widgets (dijits)

开发者 https://www.devze.com 2023-01-16 17:07 出处:网络
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...

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

精彩评论

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