O'Reilly logo

Kendo UI Cookbook by Sagar Ganatra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filtering the elements in ListView

The ListView widget can contain several list elements, and scrolling through the entire list to get to the desired list element would be time consuming. For example, consider your contacts list; to get to a particular contact, one will have to scroll several times. To obliterate this, you can add a filter and use it to retrieve the desired list element that matches the input text.

How to do it…

Let's consider a flat data source, that is, an array that contains a list of strings:

var listElements = ['Leonardo DiCaprio', 'Johnny Depp', 'Bradley Cooper', 'Al Pacino', 'Tom Cruise','Jude Law', 'Robert Downey Jr.', 'Will Smith', 'Robert De Niro', 'Christian Bale', 'Brad Pitt','Tom Hanks', 'Robert Pattinson', 'Ben Stiller']; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required