Page 1 of 1

scroll to bottom of list

Posted: Mon Aug 24, 2015 9:10 am
by Joe Sharples

I have a service with 'limit' and 'skip' parameters that pushes the response to an array, which is then set to local storage and then mapped to a list.

I have a 'load more' button that increases the skip and invokes the service again.
the result is a list that keeps extending when the user clicks 'load more.

This all works well except after the service is called and the results mapped the page jumps to the top of the list.

what code can i use to scroll to the bottom of the page?


scroll to bottom of list

Posted: Mon Aug 24, 2015 10:41 am
by Serhii Kulibaba

Hello Joe,

You have to change parameter "skip" in every next run. Please look this tutorial: https://blog.appery.io/2015/07/how-to...


scroll to bottom of list

Posted: Tue Aug 25, 2015 3:59 pm
by Joe Sharples

Thanks Sergiy,

I've followed the tutorial but i'm having a problem.
Using dev tools i can see that the service on page show has blank values for limit and skip.

I use the code in the documentation on page show to set the storage variable:
pre
var infiniteList = {limit: "12", skip: "0", noMoreItems: undefined};
Apperyio.storage.profileInfinite.set(infiniteList);
jQuery( window ).scroll(onScrollHandler);

console.log("infiniteList:" + infiniteList);
var infinLSV = Apperyio.storage.profileInfinite.get();
console.log("infinLSV skip: "+ infinLSV.skip);
/pre

I set the model and storage up the same way as in the tutorial, but changing the name.
Image

Image

The storage variable after page show is 'object Object'.
Image

and here is the console.log from the page show event:
Image


scroll to bottom of list

Posted: Tue Aug 25, 2015 4:03 pm
by Joe Sharples

what am i doing wrong?


scroll to bottom of list

Posted: Wed Aug 26, 2015 1:07 pm
by Joe Sharples

I'm getting very close to my deadline for finishing version 1 of my app. Is there a piece of code i can use to force the page to scroll to the bottom? as a work around.

I will continue implementing your method after I have launched version 1, but just for now is there a way to make the page scroll to the bottom?

Thank you


scroll to bottom of list

Posted: Fri Aug 28, 2015 1:15 pm
by Joe Sharples

I have used
$.mobile.silentScroll();
as a work around for now to force the page to scroll


scroll to bottom of list

Posted: Fri Aug 28, 2015 2:06 pm
by Illya Stepanov

Thanks for the update, Joe!