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

Is there a way to do pagination in TableViews? I'm looking to fetch the next recordset when you are at the bottom of the table. Similar to how the Apple Store does it.

I have tons of data and loading them all at once is too long and server intensive.


— asked June 8th 2010 by Ian Duchesne
  • pagination
  • tableview

4 Answers

  • Anyone have a solution or a suggestion?

    I've tried to use a ScrollView and add the TableView inside but that didn't help, the scroll events don't get triggered on the ScrollView.

    Help would be appreciated?


    — answered June 9th 2010 by Ian Duchesne
    1 Comment
    • I think there are some new events coming for Ti 1.4 that include a "scrolled" (or "scrolling" or something like that) so you know when/where a tableview is being scrolled. It was mentioned on one of Jeff Haynie's blog posts regarding the "pull to refresh" for tableview.

      — commented June 9th 2010 by karlo kilayko
  • sorry posted twice.

    — answered June 9th 2010 by Ian Duchesne
  • I have a similar issue in my app. The app store has a button at the bottom of the list that fetches the next 25 results.

    I did this in my app.

    What I did was made the button in the footer view of the table and then when it's tapped, it grabs the next set of results from my server and then appends the data to the bottom of the table.

    Attempting to do an auto-scroll may not be desired, as it will call up results when it's not necessary. Also, with the new AT&T data plans, you want to be more conscience of when you automatically pull data, so the button works nicely to achieve this.

    — answered June 9th 2010 by Alexander Stone
  • What about having:

    var data = [];
    function appendData(){
         //get server json
         data.push(--insert new data into array--);

    If you run appendData() the first time, it will add records to the empty 'data' array. The second time it will take what's already in the 'data' array and should append to it.

    Let me know how it goes.

    — answered June 9th 2010 by Ryan Gartin
    • Thanks for the answers, not quite what I was looking for. This can be used to append the data though.

      I'm looking for an "event" or "trigger" that when you reach then end of the table, fetch the next set of records automatically.

      Make sense?

      — commented June 9th 2010 by Ian Duchesne
    • Ryan Gartin, can u poste ur code complete, and i suggest add button previous

      — commented October 3rd 2011 by mahmoud kamal
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.