Page 1 of 2

How to create pagination and "next" "prev" buttons?

Posted: Sat Jan 26, 2013 5:58 pm
by Jarek Sępek

Hi, I am new to tiggzi and coding in general.

All I want to do is a simple app with paginated database results (I use parse.com and REST API).

I want to have one result on a page and "prev" and "next" buttons. How to do it, step by step? Where to start? Please advise.

Thanks!

Jarek


How to create pagination and "next" "prev" buttons?

Posted: Sat Jan 26, 2013 7:35 pm
by maxkatz

The REST API needs to support pagination. It needs to provide parameters for starting point and how many records to return.

The next/prev buttons would pass parameters such as starting point and number of records to show next (or previous).

If you are new to programming in general, I highly recommend to try JavaScript and jQuery Mobile lessons at http://codecademy.com. Then, try all our Beginner tutorials: http://docs.tiggzi.com/tutorials


How to create pagination and "next" "prev" buttons?

Posted: Sat Jan 26, 2013 11:13 pm
by Jarek Sępek

Hi Max,
thanks for that. Could you please be more specific - what parameters do I need to provide? I created previous button and service with "skip" and "limit" with value 1. When I click the button, it returns previous item. But when I click it again, nothing happens. So I am not sure how to set the starting point you've mentioned.
Please help. Thanks!


How to create pagination and "next" "prev" buttons?

Posted: Sat Jan 26, 2013 11:30 pm
by maxkatz

The parameters - depend on the service you are using. What's the service you are using?


How to create pagination and "next" "prev" buttons?

Posted: Tue Jan 29, 2013 8:55 pm
by Jarek Sępek

Hi, I am using Parse.com


How to create pagination and "next" "prev" buttons?

Posted: Tue Jan 29, 2013 9:55 pm
by maxkatz

What have you tried..? Do you have the curl commands from Parse to get the next/prev records?


How to create pagination and "next" "prev" buttons?

Posted: Tue Jan 29, 2013 10:09 pm
by Jarek Sępek

Their docs mention only "limit" and "skip" to do pagination. Unfortunatelly they dont mention how to do next/prev button. I looked everywhere for a simple tutorial but couldnt find anything.


How to create pagination and "next" "prev" buttons?

Posted: Wed Jan 30, 2013 1:25 am
by maxkatz

Those are the two parameters you need to create pagination.

limit - is how many to display
skip - how many to skip (at which record to start).

For example, if you have 100 records.
limit = 10
skip = 0

will display the first 10.

limit = 10
skip = 10

will display the 11-20

You would need to update limit/skip in the URL during run time.

I'll post an example later this week of how to do it in Tiggzi.


How to create pagination and "next" "prev" buttons?

Posted: Wed Jan 30, 2013 7:28 am
by Jarek Sępek

I just dont know how to update limit and skip everytime I click prev/next buttons. I will be waiting for your post.
Thank you very much Max!
Regards
Jarek


How to create pagination and "next" "prev" buttons?

Posted: Wed Jan 30, 2013 2:31 pm
by Jahmarley

looking forward to this tutorial.