Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #19 from GUI/master

Bind the tagSource callback to the tag-it context
  • Loading branch information...
commit 00d7a4aa8a22b2aa3353fb25d6cd7efbc5961dc9 2 parents 21fda6e + 565a6e4
@aehlke aehlke authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 js/tag-it.js
View
9 js/tag-it.js
@@ -103,14 +103,19 @@
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()));
};
+ // Bind tagSource callback functions to this context.
+ if ($.isFunction(this.options.tagSource)) {
+ this.options.tagSource = $.proxy(this.options.tagSource, this);
+ }
+
this.tagList
.addClass('tagit')
.addClass('ui-widget ui-widget-content ui-corner-all')
Please sign in to comment.
Something went wrong with that request. Please try again.