Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ion search show list when start typing

$
0
0

@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

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>