简体   繁体   中英

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

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

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

This will fire automatically onchange on your widget.

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

For a more advanced scenario:

In case you add custom property of using a custom widget you should define custom setter.

More information can be found here: https://dojotoolkit.org/reference-guide/1.10/dijit/_WidgetBase.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM