Gregory Vaughan
Posts: 0
Joined: Thu Sep 19, 2013 8:49 pm

infinite scrolling demo, how to clear list for fresh data

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.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

infinite scrolling demo, how to clear list for fresh data

Hello Gregory,

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

John de Guerto
Posts: 0
Joined: Mon Nov 30, 2015 1:45 pm

infinite scrolling demo, how to clear list for fresh data

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.

Return to “Issues”