Triggering a function after repeater lazy loading

Hi,

I’ve got a function using forEachItem that loops through all the items in a repeater and checks whether they’re in a wishlist.

The repeater utilises lazy loading so you just scroll down and the next batch of items in the repeater appear.

Triggering that function on the repeater for those items loaded in the first instance is working fine. However, it’s not triggering on the subsequent loading of repeater items via lazy loading.

Question: What onreadys do I need to make sure the function only triggers once the next batch of repeater items have loaded and fully rendered?

Hi Giles,

Please provide some code in a code block so we can see what code you have now.
This way its easyer to understand what happends now,and we can provide a better solution by editing the code.

Kind regards,
Kristof.

Hey Kristof, I posted a similar question here which has the code blocks on https://www.wix.com/velo/forum/coding-with-velo/updating-repeater-items-not-always-working?postId=6207fdc70b8d6d0017ec8045&origin=notification

Reason for posting here as well as the above was probably quite a lot of info for someone to consume so wanted to simplify the ask.

Any help would be amazing, thank you

I think you should set your code to datasets, not data. I show the code below as an example. I am usually using this code while making loaders.

export function loadingStrip_viewportEnter ( event ){

$w ( “#loadingGif” ). show ();

$w(“#dataset”).onCurrentIndexChanged(function(){
$w ( “#loadingGif” ). hide ();
})

}

https://www.wix.com/velo/reference/wix-dataset/dataset/oncurrentindexchanged

Hi Giles,

i found a small problem in your code that might be the problem.

When looking on the other post - > second code block you do this:

$w("#Scraper").loadMore().then(()=>{$w("#loadingGif").hide();}).then()$w("#Scraper").onReady(()=>{$w("#allOfThem").forEachItem(($item,itemData,index)=>{

Your .then is wrongfully formulated.

It should be
.then(()=>{
All i see is .then()

Kind regards,
Kristof.