bug fixed in dropDown

This commit is contained in:
Dani Herrero 2017-06-29 14:28:22 +02:00
parent 6365a06cbb
commit 3bb1eef43d
2 changed files with 11 additions and 4 deletions

View File

@ -34,7 +34,9 @@ export default class DropDown {
this.search = '';
this.showLoadMore = this.loadMore != null;
if (this.filterAction) {
this.filterAction();
this.filterAction({search: this.search});
} else {
this.filterItems();
}
}
}

View File

@ -7,6 +7,7 @@ export default class IconMenu {
this.$http = $http;
this.$timeout = $timeout;
this._showDropDown = false;
this.finding = false;
}
get showDropDown() {
return this._showDropDown;
@ -18,16 +19,20 @@ export default class IconMenu {
if (!this.url)
return this.items ? this.items : [];
if (search) {
if (search && !this.finding) {
let filter = {where: {name: {regexp: search}}};
let json = JSON.stringify(filter);
this.finding = true;
this.$http.get(`${this.url}?filter=${json}`).then(
json => {
this.items = json.data;
this.finding = false;
},
() => {
this.finding = false;
}
);
} else {
} else if (!search && !this.finding) {
this.items = [];
this.getItems();
}