Last active
August 29, 2015 14:01
-
-
Save exclusiveTanim/c372e5485482acdac6cf to your computer and use it in GitHub Desktop.
Adding search Bar on TableView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Hello, I have tested this issue in Ti SDK 3.3.0.RC. Its working good. | |
Testing Environment: | |
Titanium SDK: 3.3.0.RC, 3.2.3.GA | |
Titanium CLI: 3.2.3 | |
IOS Simulator 7.1 | |
Appcelerator Studio, build: 3.3.0.201406271159 | |
SearchBar is a specialized text field for entering search text. | |
Search bars are most commonly used for filtering the rows in a TableView. | |
And the table view is used to present information, organized in sections and rows, | |
in a vertically-scrolling view. In this article we learn how to use the SearchBar in | |
the TableView. We can see the following example:*/ | |
var win = Ti.UI.createWindow(); | |
win.open(); | |
var search = Titanium.UI.createSearchBar({ | |
showCancel : false, | |
hintText : 'Search Customer' | |
}); | |
search.addEventListener('change', function(e) { | |
e.value ;// search string as user types | |
}); | |
search.addEventListener('return', function(e) { | |
//search.blur(); | |
}); | |
search.addEventListener('cancel', function(e) { | |
//search.blur(); | |
}); | |
//TableView: | |
var data = [{ | |
title : 'A 100'}, | |
{ | |
title : 'B 100'}, | |
{ | |
title : 'C 200'}]; | |
var tableView = Titanium.UI.createTableView({ | |
search : search, | |
filterCaseInsensitive : false, | |
filterAttribute : "title", | |
data : data | |
}); | |
win.add(tableView); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment