autocomplete bug fixed in loadMore button
This commit is contained in:
parent
bf903d8b1e
commit
1bc3a0bdd7
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div ng-transclude="vnItem">{{item.name}}</div>
|
||||
</li>
|
||||
<li
|
||||
ng-if="$ctrl.loadMore"
|
||||
ng-if="$ctrl.loadMore&&!$ctrl.removeLoadMore"
|
||||
class="dropdown__loadMore"
|
||||
tabIndex="-1"
|
||||
ng-class="{'active': $ctrl.itemsFiltered.length === $ctrl.activeOption, 'noMore' : !$ctrl.showLoadMore}"
|
||||
|
|
|
@ -57,7 +57,7 @@ export default class DropDown {
|
|||
this.$timeout(() => {
|
||||
this._activeOption = value;
|
||||
// AutoLoad items with "scroll" (1st version):
|
||||
if (value && value >= this.items.length - 3) {
|
||||
if (value && value >= this.items.length - 3 && !this.removeLoadMore) {
|
||||
this.loadItems();
|
||||
}
|
||||
});
|
||||
|
@ -174,6 +174,7 @@ module.component('vnDropDown', {
|
|||
selected: '=',
|
||||
search: '=?',
|
||||
loadMore: '&?',
|
||||
removeLoadMore: '<?',
|
||||
filterAction: '&?',
|
||||
showLoadMore: '<?',
|
||||
top: '<?',
|
||||
|
|
Loading…
Reference in New Issue