Repeater doesn't select first item after Update Rows

All,

I have a prototype with a few repeaters. I set the first row’s IsSelected column to “True” based on Item.index == 1 in the OnLoad event. But if I do an Update Rows action on it afterward, the first row doesn’t get selected.

Is there a better way to set the first row as selected in a repeater that will work even if the repeater is updated or filtered?

Thanks so much in advance, Axperts!

Hi!

OnLoad runs only once, when the repeater is first initialized. It’s like OnPageLoad in that respect.

OnItemLoad is where you want to put the “if [[Item.index]] equals 1” condition.

2 Likes

I tried that and ended up with two rows selected. Because wouldn’t OnItemLoad cause the first row to always be selected, even when row 3 is selected?

Hi!

Hmmm. I don’t see why that would happen. Can you upload your file - or, if not, can you post a screen grab of your OnItemLoad interaction?

OnLoad
Update Rows Set IsSelected to “True” where “Item.index == ‘1’]]” in Repeater

OnItemLoad
If “[[Item.IsSelected]]” equals “True”
Set Dynamic Panel to Selected

OnMouseUp (Dynamic Panel Selection)
Mark Rows All in Repeater
Update Rows Set IsSelected to “False” for Marked in Repeater
Update Rows Set IsSelected to “True” for This in Repeater

Hi!

That works for me. I’ll upload my sample:

single-select-repeater.rp (58.5 KB)

1 Like

Hmmm. Whenever I do Update Rows from outside of the Repeater, seems like is when the first row is no longer selected, because of OnLoad…

Hi rpjcfux,

As josephxbrick mentions in his first post, the “OnLoad” interaction of a repeater only fires when the repeater is first initialized. The “OnItemLoad” interaction, however, is fired whenever a repeater item is loaded or reloaded via an action such as adding or updating rows. If your OnItemLoad interaction is selecting the repeater items where the value in the “IsSelected” column is “true”, you might be seeing that multiple rows are being selected when updating the rows in your repeater because those items’ IsSelected values are still set to true.

If you’re still finding that your repeater isn’t behaving as expected, would you be able to attach a copy of your .rp file, or an example .rp file demonstrating how your interactions are set up? That should help us get a closer look at what’s going on. Thanks!

thans your answer , it;s helpful for me