So what happens when your user wants to search all data in your TableView? By far the easiest way is to use the SearchBar component. This is a standard control that consists of a searchable text field with an optional cancel button, and attaches to the top of your table view using the table view's searchBar
property.
In this next recipe, we will implement a search bar into our MyRecipes app that filters our recipes based on the title
property.
First of all, create a searchBar
component before your tableView
is defined, and then create the event listener's for the searchBar
.
//define our search bar which will attach //to our table view var searchBar = Titanium.UI.createSearchBar({ showCancel:true, height:43, top:0 }); //print out the searchbar value whenever it changes searchBar.addEventListener('change', function(e){ //search the...