简体   繁体   English

如何从dojo的FilteringSelect中获取所有值?

[英]How to get all the values from a FilteringSelect in dojo?

I have a FilteringSelect called select , and the values are being added from different places. 我有一个称为select的FilteringSelect,值是从不同的地方添加的。 At one point of time, I wanted to access all the values from the FilteringSelect. 在某个时间点,我想访问FilteringSelect中的所有值。

In order to get a single value, I can use select.get('value') . 为了获得单个值,我可以使用select.get('value') But I wanted to have all the values in an array. 但是我想将所有值都放在一个数组中。 In jQuery, we can do something like below, 在jQuery中,我们可以执行以下操作,

var values = $('#select').val();    //returns an array

So, how to do the same in dojo? 那么,如何在dojo中做同样的事情?

If you want to get the list of 'options' in the FilteringSelect you can inspect the data element of the store. 如果要在FilteringSelect中获取“选项”列表,则可以检查商店的数据元素。

eg 例如

define([dijit/registry'], function(registry) {
    // this will return an array of options
    registry.byId('select').get('store').data;
});

happy coding. 快乐的编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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