2

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.

4

1 回答 1

2

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.

于 2013-06-04T09:58:44.350 回答