Titanium Community Questions & Answer Archive

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

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

— asked October 29th 2010 by Connor Zwick
  • buttonbar
  • filter
  • tableview
0 Comments

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.

    — answered April 22nd 2011 by Ralph Brandi
    permalink
    0 Comments
  • 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…

    — answered October 29th 2010 by Doug Handy
    permalink
    0 Comments
  • (For some reason this was posted twice, so I removed the second posting.)

    — answered April 22nd 2011 by Ralph Brandi
    permalink
    0 Comments
  • Hi Ralph!

    Have you managed to solve the problem? I got the exact same problem with my app today.

    Cheers,
    Franz

    — answered June 9th 2011 by Franz Hess
    permalink
    0 Comments
  • 25

    — answered June 19th 2012 by Bill Freedman
    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.