Titanium Community Questions & Answer Archive

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

TableViewRow - Timeline filter

Hi there,

a similar question is been already asked but no answers so I try here.

I have a TableView that contain lots of TableViewRow with different label, imageview etc.
Something like that:

var row = Titanium.UI.createTableViewRow({height:'auto'});
var avatar = Titanium.UI.createImageView({ ... });
var firstlastname = Titanium.UI.createLabel({ ... });
row.add(avatar);
row.add(firstlastname);
data[dataIndex++] = row;

I also have a SearchBar that fires a "change" event and from here I'd like to hide/show a specific row that match or not my search criteria.

I've been trying different options (background colours - works for example) but nothing like: height, visible, rowheight etc. seems to work.

Any clue?

— asked June 15th 2010 by Joe Maffia
  • filter
  • searchbar
  • tableview
  • tableviewrow
0 Comments

1 Answer

  • If you're trying to filter based on matching against a simple string attribute you can pass your searchbar into the tableview constructor, along with a filterAttribute property, and the tableview will handle the filtering automatically.

    If you want more advanced filtering you probably have to create an array of filtered rows in your 'change' event listener and use setData to repopulate the table.

    I've used both approaches with reasonable results.

    — answered June 25th 2010 by Alan McConnell
    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.