Permalink
Browse files

Bind the tagSource callback to the tag-it context. This allows custom…

… callbacks to access tag-it functions, such as assignedTags(), like the default callback does.
  • Loading branch information...
1 parent 440b9b7 commit 453e1139fb05fd72bc8c244a220b1834ceb2541d @GUI GUI committed Aug 18, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 js/tag-it.js
View
@@ -103,13 +103,14 @@
this.options.tagSource = this.options.tagSource || function(search, showChoices) {
var filter = search.term.toLowerCase();
- var choices = $.grep(that.options.availableTags, function(element) {
+ var choices = $.grep(this.options.availableTags, function(element) {
// Only match autocomplete options that begin with the search term.
// (Case insensitive.)
return (element.toLowerCase().indexOf(filter) === 0);
});
- showChoices(that._subtractArray(choices, that.assignedTags()));
+ showChoices(this._subtractArray(choices, this.assignedTags()));
};
+ this.options.tagSource = $.proxy(this.options.tagSource, this);
this.tagList
.addClass('tagit')

0 comments on commit 453e113

Please sign in to comment.