Page 1 of 1

Pagination and Dynamic total variable

Posted: Thu Aug 07, 2014 4:41 am
by John Stockinger

Hello,

I used this tutorial to add pagination to my app

http://devcenter.appery.io/tutorials/...

It worked great, but I'd like to be able to set the 'total' variable dynamically based on the number of records in my database.

localStorage.setItem('total', 3); <-- I want the 3 to be dynamic

Do you have any direction on how to set that number to be dynamic?

Thank you,
John


Pagination and Dynamic total variable

Posted: Thu Aug 07, 2014 7:44 am
by Maryna Brodina

Hello!

As mentioned in tutorial "run a service to count how many objects there are". Here is more information http://devcenter.appery.io/documentat...


Pagination and Dynamic total variable

Posted: Fri Aug 08, 2014 3:40 am
by John Stockinger

That gave me what I needed! Thank you :)

For anyone who has the same problem, this is the JS i ended up with

localStorage.setItem('total', parseInt(localStorage.getItem('count')));

count was a local variable set with a query_service service that was invoked when my page loaded.

I had to add a parameter name to the Request portion of the service, which I also called count :)


Pagination and Dynamic total variable

Posted: Fri Aug 08, 2014 3:59 am
by Alena Prykhodko

John,

Thank you for sharing solution.