Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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();
});
— asked August 31st 2010 by Colton Arabsky
  • android
0 Comments

5 Answers

  • Accepted Answer

    There is a document in the Programming Guides section that talks about continuous integration.

    — answered August 31st 2010 by Don Thorp
    permalink
    1 Comment
    • Ah, there we go. Got it!! Thank you Don for your help :)

      — commented August 31st 2010 by Colton Arabsky
  • 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';
    
    }
    
    — answered June 7th 2013 by Jayesh Joshi
    permalink
    0 Comments
  • Bump!

    — answered August 31st 2010 by Colton Arabsky
    permalink
    0 Comments
  • You've probably run into this issue Ticket 1617 it's fixed and available from the CI build.

    — answered August 31st 2010 by Don Thorp
    permalink
    0 Comments
  • 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…

    — answered August 31st 2010 by Colton Arabsky
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.