简体   繁体   中英

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. At one point of time, I wanted to access all the values from the FilteringSelect.

In order to get a single value, I can use select.get('value') . But I wanted to have all the values in an array. In jQuery, we can do something like below,

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

So, how to do the same in dojo?

If you want to get the list of 'options' in the FilteringSelect you can inspect the data element of the store.

eg

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

happy coding.

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