Page 1 of 1

infinite scrolling demo, how to clear list for fresh data

Posted: Tue Nov 17, 2015 4:21 pm
by Gregory Vaughan

Hi, I'm following the Infinite Scroll example. I have it working, but rather than the single list on page load, I may want to change a parameter and query the service again. So I need to set the skip to 0, and clear out the list before I execute the service. What is the best way to clear the list? Whatever I try the new data seems to be appended to the end of the list (which should only be done when I scroll to the bottom of the page).

I've tried .empty(), and Appery('list').find("li").not("[dsid=listItem]").remove();
and a distinct service instance that maps directly instead of using the javascript before the map.


infinite scrolling demo, how to clear list for fresh data

Posted: Fri Nov 20, 2015 10:04 am
by Serhii Kulibaba

Hello Gregory,

You can clear this list with the service, which returns an empty array.


infinite scrolling demo, how to clear list for fresh data

Posted: Mon Nov 30, 2015 1:48 pm
by John de Guerto

Hi Gregory,

Here is how I did this;

jQuery("[name='yourlist']").find("li:not(.first)").remove(); or .detach() or empty() depends on you.

this will remove all elements except the first li so that you can prepend data when you change the query.

give that a try.