Displaying Search Results

The final step is to display the matching search results in the Search Results page. I already created the Search Results Page in the previous section when I discussed using the Search charm. I will use the very same Search Results page with the SearchBox control.

When a user submits a search query from the SearchBox control then the querysubmitted event is raised. The My Notes app handles the querysubmitted event with the code in Listing 13.8.

LISTING 13.8 Handling the querysubmitted Event (\pages\home\home.js)

// Listen for search queriesvar search = document.getElementById("search").winControl;search.addEventListener("querysubmitted", function (e) {    WinJS.Navigation.navigate("/pages/searchResults/searchResults.html" ...

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.