Changes when loading indicator is added to dropdown

Previously it was added when you started typing. But there is actually a delay before sending any requests which meant the loading icon was visible but it wasn't actually loading anything
This commit is contained in:
Phil Hughes 2017-02-17 16:50:58 +00:00
parent dc303fe2db
commit 8cbf27af2b

View file

@ -47,9 +47,10 @@
} }
// Only filter asynchronously only if option remote is set // Only filter asynchronously only if option remote is set
if (this.options.remote) { if (this.options.remote) {
$inputContainer.parent().addClass('is-loading');
clearTimeout(timeout); clearTimeout(timeout);
return timeout = setTimeout(function() { return timeout = setTimeout(function() {
$inputContainer.parent().addClass('is-loading');
return this.options.query(this.input.val(), function(data) { return this.options.query(this.input.val(), function(data) {
$inputContainer.parent().removeClass('is-loading'); $inputContainer.parent().removeClass('is-loading');
return this.options.callback(data); return this.options.callback(data);