Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Alex Ehlke aehlke authored

Showing 1 changed file with 7 additions and 2 deletions. Show diff stats Hide diff stats

  1. +7 2 js/tag-it.js
9 js/tag-it.js
@@ -103,14 +103,19 @@
103 103
104 104 this.options.tagSource = this.options.tagSource || function(search, showChoices) {
105 105 var filter = search.term.toLowerCase();
106   - var choices = $.grep(that.options.availableTags, function(element) {
  106 + var choices = $.grep(this.options.availableTags, function(element) {
107 107 // Only match autocomplete options that begin with the search term.
108 108 // (Case insensitive.)
109 109 return (element.toLowerCase().indexOf(filter) === 0);
110 110 });
111   - showChoices(that._subtractArray(choices, that.assignedTags()));
  111 + showChoices(this._subtractArray(choices, this.assignedTags()));
112 112 };
113 113
  114 + // Bind tagSource callback functions to this context.
  115 + if ($.isFunction(this.options.tagSource)) {
  116 + this.options.tagSource = $.proxy(this.options.tagSource, this);
  117 + }
  118 +
114 119 this.tagList
115 120 .addClass('tagit')
116 121 .addClass('ui-widget ui-widget-content ui-corner-all')

0 comments on commit 00d7a4a

Please sign in to comment.
Something went wrong with that request. Please try again.