@RenzoM78 wrote:
Hi all,
I have a list and when I search items the list shrinks when start typing a letter. What I want is to hide the list until a user starts typing. What can I do to do that. I know I have to change something and have to insert an if… But where?// Selectie op toetsaanslagen getItems(searchbar) { // Reset items back to all of the items this.initializeItems(); // set q to the value of the searchbar var q = searchbar.srcElement.value; // if the value is an empty string don't filter the items if (!q) { return; } this.productList = this.productList.filter((v) => { if(v.name && q) { if (v.name.toLowerCase().indexOf(q.toLowerCase()) > -1) { return true; } return false; } }); console.log(q, this.productList.length); } //Einde selectie op toetsaanslagen
Posts: 1
Participants: 1