coder247 coder247 - 1 year ago 137
Javascript Question

dijit/form/FilteringSelect: How can I trigger an onchange event manually

I want to set a value to the dijit FilteringSelect and then call an event manually.

I tried it like this:

registry.byId( "mySelect" ).value = "11";
registry.byId( "mySelect" ).change();
// Tried with onchange() also

Answer Source

Use the following code to change the value for your widget.

registry.byId( "mySelect" ).set('value', 11);

This will automatically fired onchange on your widget.

Please note you should always change value of your widget property using a setter, this will maintain a proper life-cycle execution.