|
@@ -9720,6 +9720,7 @@ define('select2/results',[
|
|
|
|
|
|
Results.prototype.displayMessage = function (params) {
|
|
Results.prototype.displayMessage = function (params) {
|
|
this.clear();
|
|
this.clear();
|
|
|
|
+ this.hideLoading();
|
|
|
|
|
|
var $message = $('<li role="treeitem" class="option"></li>');
|
|
var $message = $('<li role="treeitem" class="option"></li>');
|
|
|
|
|
|
@@ -9731,6 +9732,8 @@ define('select2/results',[
|
|
};
|
|
};
|
|
|
|
|
|
Results.prototype.append = function (data) {
|
|
Results.prototype.append = function (data) {
|
|
|
|
+ this.hideLoading();
|
|
|
|
+
|
|
var $options = [];
|
|
var $options = [];
|
|
|
|
|
|
if (data.length === 0) {
|
|
if (data.length === 0) {
|
|
@@ -9796,6 +9799,26 @@ define('select2/results',[
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ Results.prototype.showLoading = function (params) {
|
|
|
|
+ this.hideLoading();
|
|
|
|
+
|
|
|
|
+ var loadingMore = this.options.get('translations').get('loadingMore');
|
|
|
|
+
|
|
|
|
+ var loading = {
|
|
|
|
+ disabled: true,
|
|
|
|
+ loading: true,
|
|
|
|
+ text: loadingMore(params)
|
|
|
|
+ };
|
|
|
|
+ var $loading = this.option(loading);
|
|
|
|
+ $loading.className += ' loading-results';
|
|
|
|
+
|
|
|
|
+ this.$results.prepend($loading);
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ Results.prototype.hideLoading = function () {
|
|
|
|
+ this.$results.find('.loading-results').remove();
|
|
|
|
+ };
|
|
|
|
+
|
|
Results.prototype.option = function (data) {
|
|
Results.prototype.option = function (data) {
|
|
var option = document.createElement('li');
|
|
var option = document.createElement('li');
|
|
option.className = 'option';
|
|
option.className = 'option';
|
|
@@ -9888,6 +9911,10 @@ define('select2/results',[
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ container.on('query', function (params) {
|
|
|
|
+ self.showLoading(params);
|
|
|
|
+ });
|
|
|
|
+
|
|
container.on('select', function () {
|
|
container.on('select', function () {
|
|
if (!container.isOpen()) {
|
|
if (!container.isOpen()) {
|
|
return;
|
|
return;
|