lukisp
lukisp

Reputation: 1081

Dojo FilteringSelect - update drop down list or manualy filter

I want to update drop down list in FilteringSelect after set displayValue. I know that FilteringSelect chose first element from results after set displayValue, but when I open drop down list (openDropDown() function) it has old filter results.

Upvotes: 2

Views: 1553

Answers (1)

Dimitri Mestdagh
Dimitri Mestdagh

Reputation: 44757

That's because there's a difference between the displayed value and the dropdown. The FilteringSelect widget uses a store to fill the dropdown. If you want the dropdown to change, you will have to change your object in your store too.

Depending on your version of Dojo you will have to work with the dojo/store or dojo/data API. For the dojo/stor API (new versions of Dojo) you have to do something like:

var myItem = filteringSelect.item;
myItem.name = "Testing 1 2 3";
myStore.put(filteringSelect.item);

Based on the ID it will update that object.

An example JSFiddle can be found here. It will replace the displayedValue and the store itself when you click the "Test" button.


UPDATE: I noticed your answer (you should have commented on me because now I didn't get any notification in my inbox);

If I understand it correctly you want to enter a value programmatically and open the dropdown with the highlighted results. Well, this is possible with:

filteringSelect._startSearch("C");

This is a function the AutoCompleterMixin provided. You can see the result at my updated JSFiddle.

Upvotes: 2

Related Questions