Repeater items

Hi everyone !!!
Here’s my current situation →

I am having a repeater in a dynamic page.
In the repeater, there is a button.
The button’s label is manually connected to the dataset (not dynamic dataset)
In the page, I will get the current item’s _id

$w('#dynamicDataset').onReady(() => {
        var id = $w('#dynamicDataset').getCurrentItem()._id;
});

What I am trying to achieve is to - change the respective button’s label, in the repeater, to the next label…

For example →
The user is in the dynamic page ‘A’ .
So, in the repeater, the button of label ‘A’ should change in to the next, which is ‘B’

I tried the collapse() function →

$w('#recipeRepeater').onItemReady(($item, itemData, index) => {
 if (itemData._id === id) {
            $item('#recipeRepButton').collapse();
        }
});

But, that doesn’t fulfill me…

Any idea ??
@J. D. @Yisrael (Wix) @Anyone

Thanks !!!

Your description is unclear. It’s hard to understand what exactly you’re trying to do.

@jonatandor35 Sorry for that !!!
Here’s what I am trying to do →

I am having a database called ‘Category’
I made a dynamic page on the base of this database.
There are 10 items in it - in the field called ‘name’.

In the the dynamic page, I am having a repeater connected to the ‘Category’ dataset ( Not the dynamic dataset )
In the repeater, there is a button. The button’s label is connected to the same dataset → to the field ‘name’

Now, in the live site, when the user is in the dynamic page of the item ‘A’
→ In the repeater, the respective button whose label is ‘A’ should not be shown and should change into the next item, which is ‘B’. Then 'B’s place should be occupied by ‘C’ …

This can be very helpful →
This is the repeater →

Now, when the user is in the dynamic page of item ‘a’ the respective button of label ‘a’ should change in to the next →

Is it possible itself ???

I tried using the collapse() function but elements do not collapse horizontally…

@ajithkrr It’s possible, but first please answer these questions:

  1. What collection field does these “a” ,“b” reflect? Is it “title”?

  2. What should be on the last item button?
    I

Thanks J. D.
Those ‘a’, ‘b’ reflect the field
‘name’
I didn’t quite understand what is → ’ What should be on the last item button?’

Thanks!!!

@ajithkrr The last item in the repeater doesn’t have a “next item” (since it’s the last item). So what would you like to do there?

@ajithkrr Or maybe you just want to remove the current item from the repeater?

@jonatandor35 Yeah ! I just want to remove the current item

@ajithkrr so first retrieve the _id of the current item, and then remove it from the data.

let dataStatus = 0;
$w.onReady(() => {
$w("#dynamicDataset, #allItemsDataset").onReady(() => {
dataStatus++;
if(dataStatus > 1){
let currentId = $w("#dynamicDataset").getCurrentItem()._id;
let allData =  $w("#allItemsDataset").getItems(0,1000)
.then(r => {
if(r){
let items = r.items;
items = items.filter(e => e._id !== currentId);
$w("#repeater1").data = items;
}
}
}
})
})

If you prefer, then instead of retrieving all items from the general dataset and filtering it using JS, you can just set filter for the general dataset with

.ne("_id", currentId)

Thanks J. D.
As usually it worked !!!

The Steps provided by @jonatandor35

"so first retrieve the _id of the current item, and then remove it from the data.’

let dataStatus = 0;
$w.onReady(() => {
$w("#dynamicDataset, #allItemsDataset").onReady(() => {
dataStatus++;
if(dataStatus > 1){
let currentId = $w("#dynamicDataset").getCurrentItem()._id;
let allData =  $w("#allItemsDataset").getItems(0,1000)
.then(r => {
if(r){
let items = r.items;
items = items.filter(e => e._id !== currentId);
$w("#repeater1").data = items;
}
}
}
})
})

“If you prefer, then instead of retrieving all items from the general dataset and filtering it using JS, you can just set filter for the general dataset with”

.ne("_id", currentId)

:grinning::grinning:
Thanks !!! :))