Skip to content

Instantly share code, notes, and snippets.

@simonwh
Created April 26, 2010 23:24
Show Gist options
  • Save simonwh/380083 to your computer and use it in GitHub Desktop.
Save simonwh/380083 to your computer and use it in GitHub Desktop.
var search = Titanium.UI.createSearchBar({});
var tableView = Titanium.UI.createTableView({
data:data,
search:search,
filterAttribute:'title',
autoHideSearch:false
});
Titanium.UI.currentWindow.add(tableView);
search.addEventListener('change', function(e)
{
if(e.value.length > 3) {
var xhrMovieSearch = Titanium.Network.createHTTPClient();
xhrMovieSearch.onload = function() {
var matches = JSON.parse(this.responseText);
var fetchedData = [];
for(var x in matches) {
fetchedData.push({title:matches[x].title});
}
tableView.setData(fetchedData);
};
xhrMovieSearch.open('GET','http://noscale.net/iwatched/do_find_movies_by_title.php?title=' + e.value);
xhrMovieSearch.send();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment