Skip to content

Instantly share code, notes, and snippets.

@doxavore
Created February 12, 2013 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doxavore/4772655 to your computer and use it in GitHub Desktop.
Save doxavore/4772655 to your computer and use it in GitHub Desktop.
setTimeout for the win. Thanks, Dojo!
// 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