Check if the input is empty before sorting and filterin options
This commit is contained in:
parent
d363b111f2
commit
a28dd087de
@ -197,7 +197,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
item_list: [],
|
item_list: [],
|
||||||
selected_items: [],
|
selected_items: [],
|
||||||
search: '', // search coLumn model
|
search: '', // search column model
|
||||||
show: {
|
show: {
|
||||||
item_selected: false,
|
item_selected: false,
|
||||||
item_list: false,
|
item_list: false,
|
||||||
@ -269,10 +269,15 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onInput() {
|
onInput() {
|
||||||
|
//to optimize performance we kept the condition that checks for if search exists or not
|
||||||
|
if (!this.search) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//condition that checks if input is below the given character limit
|
||||||
if (this.search.length < this.searchCharLimit) {
|
if (this.search.length < this.searchCharLimit) {
|
||||||
this.setItemList(this.items);
|
this.setItemList(this.items); //once the user deletes the search input, we show the overall item list
|
||||||
this.sortItems();
|
this.sortItems(); // we order it as wanted
|
||||||
this.$emit('input', this.search);
|
this.$emit('input', this.search); // keep the input binded to v-model
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user