Hello,
I’m working with a Repeater block
and I’m trying to figure out if there’s a way to retrieve the index of an item when an action (like a button click) is triggered. Specifically, I’d like to know if there’s a method or block in Codeless that allows me to get the index of the currently selected item within the Repeater
.
For example, if I have a button inside the Repeater
and a user clicks it, is there a way to determine which item in the list (i.e., its index) was clicked?
Any guidance or examples on how to achieve this would be greatly appreciated!
Thanks in advance!
Hello @Manuel_Germano,
When you’re inside the Repeater component, there is a Repeater Data Item block in each logic handler, which points to the current item.
Hope it helps!
Regards,
Stanislaw
Hello @stanislaw.grin
Thanks for the prompt support!
I´m doing what you can see in the image below, but what this returns is simply the selected list value, not its index. For example, if i have the list {1, 2, 5}, selecting the third element retrieves the value “5” and not the index position 3. Is there an easy way to get the index?
Thank you!
Regards,
Manuel
I understand. There isn’t a specific method to get the index of the currently selected item within the Repeater, but you can work around this by modifying the array. You can add the index to each item before passing them to the Repeater. Once you have the current index, you can retrieve any item in the list by its index.
Regards,
Stanislaw
OK, i will try it.
Thank you.
Regards,
Manuel