Filtering Items in a ListView Control

You can filter the items displayed in a ListView by filtering the items in the data source associated with the ListView. For example, when browsing through a large set of products, you might want to enable a user to filter the products by only showing products that match a filter string (see Figure 8.12).

Image

FIGURE 8.12 Filtering a list of products

You can take an existing WinJS.Binding.List and create a new filtered WinJS.Binding.List by calling the createFiltered() method. This method accepts a filter function that returns either the value true or false depending on whether an item from the original list ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.