如何在dojo中从FilteringSelect中获取所有值

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

本文关键字:获取 FilteringSelect dojo 中从      更新时间:2023-09-26

我有一个名为select的FilteringSelect,这些值是从不同的地方添加的。有一段时间,我想访问FilteringSelect中的所有值。

为了获得单个值,我可以使用select.get('value')。但我希望所有值都在一个数组中。在jQuery中,我们可以做如下操作,

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

那么,如何在道场做同样的事情呢?

如果您想在FilteringSelect中获得"选项"列表,您可以检查存储的数据元素。

例如

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

快乐的编码。