Searchbar on Android?
Alright I need some help. I have this tableview with all this data and I have a searchbar ontop.
The searchbar works fine for the iPhone, but on Android it does nothing. Could somebody help?
var win = Ti.UI.currentWindow;
var data = [];
for (var c=0;c<0;c++) {
var videos = '../episodes/episode1-'+c+'.3gp';
}
for (var c=0;c<lastRow;c++)
{
data[c] = {title:"Episode "+(c+1), episode:videos};
}
var search = Ti.UI.createSearchBar({
hintText:'Search...',
barColor:'#000'
});
var tableView = Ti.UI.createTableView({
data:data,
search:search,
searchHidden:false
});
win.add(tableView);
// SEARCH BAR EVENTS
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();
});
5 Answers
-
Accepted Answer
There is a document in the Programming Guides section that talks about continuous integration.
-
Assign Title in row and Take label in row and make it's filter that text and for table View assign tableView.filterAttribute : 'title' for androi and for iPhone tableView.filterAttribute = 'filter'
Like Below
var tableView = Titanium.UI.createTableView({
top : 0,left : 0});
var rowUsers = Titanium.UI.createTableViewRow({
title : (Titanium.Platform.osname == "android") ? json.data[i].username : ""
});
var name_lbl = Titanium.UI.createLabel({
top : 30,
height : 25,
left : 115,
font : {
fontSize : 20
},});
name_lbl.text = json.data[i].username;rowUsers.add(name_lbl);
rowUsers.filter = name_lbl.text;
And At the End After Assigning data to tableView
if(Titanium.Platform.osname !="android")
{ tableView.filterAttribute = 'title'; }else { tableView.filterAttribute = 'filter'; }
-
Bump!
-
You've probably run into this issue Ticket 1617 it's fixed and available from the CI build.
-
Thank you Don Thorp (I see that it was fixed), but may I ask how I actually get that onto my Titanium? I don't really understand, cause on the "Downloads" page there is only 1.4.0, which is what I already have…