Hide certain items on a dataset

Hi, I want to hide the first 15 items from a dataset and show the rest on a repeater. It might sound easy but I’m new to this and I haven’t figure it out how to do it. I would appreciate your help :slight_smile:

2 Likes

@wistickers I’m not sure of your use case here in why you are wanting to do this, but a simple way to do it would be to use the onItemReady function and collapse the container for the first 15 items. In case you’re not familiar with how repeaters work, there is always a container with a name that the various elements get added to in a repeater. Click once on the repeater and then again in an area that doesn’t have an element, and you will see the ID of the container in the property sheet.

$w.onReady(function () {
    $w("#repeater1").onItemReady(($item,itemData,index) => {
        if (index < 15) {
            $item("#container1").collapse();
        }
    })
});

Hi @tony-brunsman I found the above code which should work for me also but it is not … Could you please take a look? I have a page with two repeaters: one that shows the first collection item, and another that should show the rest of the items (so from the 2nd onwards). I added the above code like below …but the outcome is empty …
$w . onReady ( function () {
$w ( “#repeaterNac” ). onItemReady (( $item , itemData , index ) => {
if ( index < 1) {
$item ( “#containerNac” ). collapse ();
}
})
});

This is the outcome → https://mcvalenzuela3.editorx.io/newsfly23/nacional

Thanks in advance!

I went through your explanation once again … and solved it! I was using the wrong container. Great explanation @anthonyb ! Thanks