Created
February 12, 2013 19:32
-
-
Save doxavore/4772655 to your computer and use it in GitHub Desktop.
setTimeout for the win. Thanks, Dojo!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// setTimeout() because the keystroke hasn't yet appeared in the <input>, | |
// so the get('displayedValue') call below won't give the result we want. | |
setTimeout(dojo.hitch(this, function(){ | |
// set this.filterString to the filter to apply to the drop down list; | |
// it will be used in openDropDown() | |
var val = this.get('displayedValue'); | |
this.filterString = (val && !this.parse(val, this.constraints)) ? val.toLowerCase() : ""; | |
// close the drop down and reopen it, in order to filter the items shown in the list | |
// and also since the drop down may need to be repositioned if the number of list items has changed | |
// and it's being displayed above the <input> | |
if(this._opened){ | |
this.closeDropDown(); | |
} | |
this.openDropDown(); | |
}), 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment