|
70 | 70 | function indexOf(value, array) { |
71 | 71 | var i = 0, l = array.length, v; |
72 | 72 |
|
73 | | - if (typeof value == 'undefined') { |
| 73 | + if (typeof value === "undefined") { |
74 | 74 | return -1; |
75 | 75 | } |
76 | 76 |
|
|
244 | 244 | } |
245 | 245 | // TODO 3.0 - replace query.page with query so users have access to term, page, etc. |
246 | 246 | var results = options.results(data, query.page); |
247 | | - self.context = results.context; |
248 | 247 | query.callback(results); |
249 | 248 | } |
250 | 249 | }); |
|
678 | 677 | this.opts.query({ |
679 | 678 | term: this.search.val(), |
680 | 679 | page: page, |
681 | | - context: self.context, |
682 | | - matcher: self.opts.matcher, |
| 680 | + context: this.context, |
| 681 | + matcher: this.opts.matcher, |
683 | 682 | callback: this.bind(function (data) { |
684 | 683 | var parts = [], self = this; |
685 | 684 | $(data.results).each(function () { |
|
740 | 739 | var parts = [], // html parts |
741 | 740 | def; // default choice |
742 | 741 |
|
| 742 | + // save context, if any |
| 743 | + this.context = (data.context===undefined) ? null : data.context; |
| 744 | + |
743 | 745 | // create a default choice and prepend it to the list |
744 | 746 | if (this.opts.createSearchChoice && search.val() !== "") { |
745 | 747 | def = this.opts.createSearchChoice.call(null, search.val(), data.results); |
|
1478 | 1480 | val = (val === null) ? [] : val; |
1479 | 1481 | this.setVal(val); |
1480 | 1482 | // val is a list of objects |
1481 | | - st |
1482 | 1483 | $(val).each(function () { data.push(self.id(this)); }); |
1483 | 1484 | this.setVal(data); |
1484 | 1485 | this.updateSelection(val); |
|
0 commit comments