Repeater not loading code after first 12 entries

Hi, hoping to get some help. I’ve got a dataset of job listings displaying in a repeater with collapsible boxes. For the life of me I cannot figure out why this code doesn’t run beyond the first 12 entries.

$w.onReady(function () {
$w('#repeater1').forEachItem(( $item ) => {
        $item('#expandButton').onClick(() => {
            if ($item('#occupationContainer').collapsed)
                $item('#occupationContainer').expand();
            else
                $item('#occupationContainer').collapse();
        })
    })
});

When I hit item 13, the expand button no longer works. Any help?

  1. Check the dataset settings for max number of items.

  2. Put the reapeater.forEachItem inside $w(‘#dataset’).onReady(() => {/here/})

Thanks for your help!

My dataset is set to show 66 items, which is the amount in the dataset. I updated the code as below, however this didn’t solve my issue, and clicking the expand button didn’t expand the contents of the first 12.

$w('#dataset1').onReady(() => {
    $w('#repeater1').forEachItem(( $item ) => {
        $item('#expandButton').onClick(() => {
            if ($item('#occupationContainer').collapsed)
                $item('#occupationContainer').expand();
            else
                $item('#occupationContainer').collapse();
        })
    })
})

It seems like Wix loads the first 12 dataset items into the repeater and then my code runs, however the remaining dataset items only load in after the page has finished loading so the new generated repeater items don’t get the code run on them? I’m inclined to think this as Wix’s editor only loads 12 items at once so it seems like it’s possibly related? Just a guess.

I managed to get it to work by running the code once onItemReady and once forEachItem.

$w.onReady(function () {
$w('#repeater1').onItemReady(( $item ) => {
        $item('#expandButton').onClick(() => {
            if ($item('#occupationContainer').collapsed)
                $item('#occupationContainer').expand();
            else
                $item('#occupationContainer').collapse();
        })
    })
}); 

$w.onReady(function () {
$w('#repeater1').forEachItem(( $item ) => {
        $item('#expandButton').onClick(() => {
            if ($item('#occupationContainer').collapsed)
                $item('#occupationContainer').expand();
            else
                $item('#occupationContainer').collapse();
        })
    })
}); 

I’m now just trying to sort out a search function!