1
0
mirror of synced 2025-02-16 20:13:16 +03:00

Always call createSearchChoice and tokenizer with the Select2 object as this.

This commit is contained in:
Jeff Hanke 2013-06-20 18:36:12 -07:00
parent 476b34bd9a
commit 338a126067

View File

@ -598,7 +598,7 @@ the specific language governing permissions and limitations under the Apache Lic
input = input.substring(index + separator.length);
if (token.length > 0) {
token = opts.createSearchChoice(token, selection);
token = opts.createSearchChoice.call(this, token, selection);
if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
dupe = false;
for (i = 0, l = selection.length; i < l; i++) {
@ -1586,7 +1586,7 @@ the specific language governing permissions and limitations under the Apache Lic
this.context = (data.context===undefined) ? null : data.context;
// create a default choice and prepend it to the list
if (this.opts.createSearchChoice && search.val() !== "") {
def = this.opts.createSearchChoice.call(null, search.val(), data.results);
def = this.opts.createSearchChoice.call(self, search.val(), data.results);
if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
if ($(data.results).filter(
function () {
@ -2640,7 +2640,7 @@ the specific language governing permissions and limitations under the Apache Lic
// multi
tokenize: function() {
var input = this.search.val();
input = this.opts.tokenizer(input, this.data(), this.bind(this.onSelect), this.opts);
input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
if (input != null && input != undefined) {
this.search.val(input);
if (input.length > 0) {