Add 500ms delay before AJAX in Select2
We have four select2 Ajax pickers in `solidus_backend`: - Option Value Picker - Product Picker - Taxon Autocomplete - Variant Autocomplete The Variant autocomplete already has a 500ms delay between the user finishing typing and the Ajax request firing. This is good, because it stops requests happening at every keypress. This commit extends that behavior to the option value, product and taxon pickers.
This commit is contained in:
parent
0ba073802f
commit
4eec4797fa
@ -23,6 +23,7 @@ $.fn.optionValueAutocomplete = function (options) {
|
||||
},
|
||||
ajax: {
|
||||
url: Spree.pathFor('api/option_values'),
|
||||
quietMillis: 500,
|
||||
datatype: 'json',
|
||||
data: function (term, page) {
|
||||
var productId = typeof(productSelect) !== 'undefined' ? $(productSelect).select2('val') : null;
|
||||
|
@ -35,6 +35,7 @@ $.fn.productAutocomplete = function (options) {
|
||||
this.select2({
|
||||
minimumInputLength: 3,
|
||||
multiple: multiple,
|
||||
quietMillis: 500,
|
||||
initSelection: function (element, callback) {
|
||||
$.get(Spree.pathFor('admin/search/products'), {
|
||||
ids: element.val().split(','),
|
||||
|
@ -47,6 +47,7 @@ $.fn.taxonAutocomplete = function (options) {
|
||||
},
|
||||
ajax: {
|
||||
url: Spree.pathFor('api/taxons'),
|
||||
quietMillis: 500,
|
||||
datatype: 'json',
|
||||
data: function (term, page) {
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user