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?
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.