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.
Thanks.
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?
Thanks.
-
sorry posted twice.
-
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.
-
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.