TableView filter
Hi,
I have a tableview full of data, with a search filter at the top. I'd like to be able to filter the data by a button bar at the bottom. Each button has a different value for a parameter that all rows have. Is there a way to do this? If you need more information, please, just ask.
Thanks
5 Answers
-
I would also like to know the answer to this. I have an app that pulls data from a database of 26000+ records. It displays up to 600 records at a time. Most of the entities represented in the database have two or more entries based on time of day (daytime, nighttime, etc.). I added a field to each TableViewRow that contains the appropriate time of day, and associated a SearchBar with the TableView. That search bar works; if I manually enter 'd' or 'n' in it, the TableView is filtered. What doesn't work is setting the contents of the search bar programmatically. I have a TabbedBar at the bottom of the screen, and code that sets the value of the search bar to 'd' or 'n' depending on whether the Daytime or Nighttime button are clicked. I can see that the value appears in the search bar, so that code works, but it doesn't update the TableView to filter the contents the way updating the contents manually does; instead, it comes back with no results. Any suggestions? I feel like I'm so close on this one but I'm just missing something simple.
-
How is your tableview getting full of data?
Assuming it is being read from a database, one choice is to create a new WHERE clause for the SQL Select statement with the condition(s) needed for your filter, then reload the tableview.
I also see each TableViewRow object has a visible property. I have not experimented with it. Perhaps if you iterate over the existing rows and set the visible property to match your filter criteria, that may work. Or maybe it would leave blank space there instead of compressing out the non-visible rows. I don't know. Too new to Titanium myself…
-
(For some reason this was posted twice, so I removed the second posting.)
-
Hi Ralph!
Have you managed to solve the problem? I got the exact same problem with my app today.
Cheers,
Franz -
25