Titanium Community Questions & Answer Archive

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

How to add searchbar in tableview

Hello,

I want to add searchbar in basic table view, how it is possible?

— asked September 4th 2010 by vikas khairnar
  • searchbar
0 Comments

1 Answer

  • var win = Titanium.UI.currentWindow;
    
    // SEARCH BAR
    var search = Titanium.UI.createSearchBar({
        barColor:'#000', 
        showCancel:false
    });
    
    // CREATE TABLE VIEW
    var tableView = Titanium.UI.createTableView({
        data:data,
        search:search,
        searchHidden:true
    });
    
    win.add(tableView);
    

    Somethin' like that. That would create a black search bar that you would have to scroll up to view.

    Basically all you need is to have a "createSearchBar" somewhere in the file, then have "search:<SearchBar" in the createTableView and you're golden ;)

    For more properties of the Search Bar, check the API Reference.

    — answered September 4th 2010 by Colton Arabsky
    permalink
    1 Comment
    • it's working! ;) Thanks!

      — commented September 25th 2013 by Alberto Diéguez Fernández
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.