From 1bc3a0bdd721b7a1f419f4666d8c0f33c49f5eda Mon Sep 17 00:00:00 2001 From: dherrero Date: Tue, 10 Oct 2017 12:56:03 +0200 Subject: [PATCH] autocomplete bug fixed in loadMore button --- client/core/src/autocomplete/autocomplete.html | 1 + client/core/src/autocomplete/autocomplete.js | 11 +++++++++-- client/core/src/drop-down/drop-down.html | 2 +- client/core/src/drop-down/drop-down.js | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/client/core/src/autocomplete/autocomplete.html b/client/core/src/autocomplete/autocomplete.html index 65150f09c..962798629 100644 --- a/client/core/src/autocomplete/autocomplete.html +++ b/client/core/src/autocomplete/autocomplete.html @@ -7,6 +7,7 @@ filter="true" load-more="$ctrl.getItems()" show-load-more="$ctrl.maxRow" + remove-load-more="$ctrl.removeLoadMore" filter-action="$ctrl.findItems(search)" item-width="$ctrl.width" multiple="$ctrl.multiple" diff --git a/client/core/src/autocomplete/autocomplete.js b/client/core/src/autocomplete/autocomplete.js index ae31bff8c..f0e6eb304 100644 --- a/client/core/src/autocomplete/autocomplete.js +++ b/client/core/src/autocomplete/autocomplete.js @@ -23,6 +23,7 @@ class Autocomplete extends Component { this.displayValueMultiCheck = []; this._multiField = []; this.readonly = true; + this.removeLoadMore = false; } get showDropDown() { @@ -229,9 +230,11 @@ class Autocomplete extends Component { let json = JSON.stringify(filter); + this.removeLoadMore = false; + this.$http.get(`${this.url}?filter=${json}`).then( json => { - if (json.data.length) + if (json.data.length) { json.data.forEach( el => { if (this.multiple) { @@ -240,8 +243,12 @@ class Autocomplete extends Component { this.items.push(el); } ); - else + if (filter.skip === 0 && this.maxRow && json.data.length < this.maxRow) { + this.removeLoadMore = true; + } + } else { this.maxRow = false; + } } ); } diff --git a/client/core/src/drop-down/drop-down.html b/client/core/src/drop-down/drop-down.html index 59a7622de..9bab06069 100644 --- a/client/core/src/drop-down/drop-down.html +++ b/client/core/src/drop-down/drop-down.html @@ -17,7 +17,7 @@
{{item.name}}