fix ajax defaults not to interfere with options
This commit is contained in:
parent
bcfa3fc702
commit
92ceb93e93
19
select2.js
19
select2.js
@ -386,7 +386,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
var requestNumber = requestSequence, // this request's sequence number
|
var requestNumber = requestSequence, // this request's sequence number
|
||||||
data = options.data, // ajax data function
|
data = options.data, // ajax data function
|
||||||
url = ajaxUrl, // ajax url string or function
|
url = ajaxUrl, // ajax url string or function
|
||||||
transport = options.transport || $.fn.select2.defaults.ajax.transport,
|
transport = options.transport || $.fn.select2.ajaxDefaults.transport,
|
||||||
// deprecated - to be removed in 4.0 - use params instead
|
// deprecated - to be removed in 4.0 - use params instead
|
||||||
deprecated = {
|
deprecated = {
|
||||||
type: options.type || 'GET', // set type of request (GET or POST)
|
type: options.type || 'GET', // set type of request (GET or POST)
|
||||||
@ -394,7 +394,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
jsonpCallback: options.jsonpCallback||undefined,
|
jsonpCallback: options.jsonpCallback||undefined,
|
||||||
dataType: options.dataType||"json"
|
dataType: options.dataType||"json"
|
||||||
},
|
},
|
||||||
params = $.extend({}, $.fn.select2.defaults.ajax.params, deprecated);
|
params = $.extend({}, $.fn.select2.ajaxDefaults.params, deprecated);
|
||||||
|
|
||||||
data = data ? data.call(self, query.term, query.page, query.context) : null;
|
data = data ? data.call(self, query.term, query.page, query.context) : null;
|
||||||
url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
|
url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
|
||||||
@ -2502,7 +2502,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
|
|
||||||
this.updateResults(true);
|
this.updateResults(true);
|
||||||
this.search.focus();
|
this.search.focus();
|
||||||
this.opts.element.trigger($.Event("open"));
|
this.opts.element.trigger($.Event("select2-open"));
|
||||||
},
|
},
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
@ -3003,18 +3003,19 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
return replace_map[match];
|
return replace_map[match];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
ajax: {
|
blurOnChange: false,
|
||||||
|
selectOnBlur: false,
|
||||||
|
adaptContainerCssClass: function(c) { return c; },
|
||||||
|
adaptDropdownCssClass: function(c) { return null; }
|
||||||
|
};
|
||||||
|
|
||||||
|
$.fn.select2.ajaxDefaults = {
|
||||||
transport: $.ajax,
|
transport: $.ajax,
|
||||||
params: {
|
params: {
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
blurOnChange: false,
|
|
||||||
selectOnBlur: false,
|
|
||||||
adaptContainerCssClass: function(c) { return c; },
|
|
||||||
adaptDropdownCssClass: function(c) { return null; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// exports
|
// exports
|
||||||
|
Loading…
Reference in New Issue
Block a user