Reputation: 4271
I'm trying to change the query of a filtering select's data store, such that the dropdown only displays the values that were queried with a query such as this (note that I can't even get it to work with a non-regex query):
var query = {
id: new RegExp("^(1|12)$")
};
See this JSFiddle.
Note that I do not want to fetch
the result set using
dropdown.store.fetch({query: query, onComplete: function(results) {} });
I want the results to filter in the dropdown.
Despite viewing this and several other related questions, I haven't been able to get a solution that works for a FilteringSelect as I intend. Any help is appreciated.
Upvotes: 3
Views: 1902
Reputation: 4271
To do what I was trying to do, you have to query the FilteringSelect, not the store.
dropdown.query.id = /^(1|12)$/;
But even better, this works for all queries, not just regex, since the function can be anything:
dropdown.query.id = {
test: function (id) {
return [1, 12].indexOf(id) > -1;
}
};
Note: This query
property is inherited from dijit/form/_SearchMixin
. See the properties of FilteringSelect
.
Upvotes: 3