Setting the value (selected option) of a dijit.form.Select widget

…衆ロ難τιáo~ 提交于 2019-11-30 08:46:49

Even if your values are ints, if you set your integer to a string then this will work.

dijit.byId( 'my_select' ).attr( 'value', String( 5 ) );

Turns out it's a bug - if the option values aren't strings, it won't work (mine were integers).

jbarz

Repost of my comment: There is a test page here: dojo archive that you can mess with. Using fire-bug I used dijit.byId('s9').attr('value', 'CO') successfully on that page. That will set the "store-based" Select on that page.

But as you said I set it using a string and you were using integers so I didn't see the bug. Good catch.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!