Adding a row to repeater clears previous selection

I made a repeater to be able to make a selection, then add a row and make another selection. The problem is when I add another row it clears the previous one. Any help is appreciated.

I’ve attached the file for reference.

Add Object Dynamically.rp (48.1 KB)

Hi!

Unless there is code that sets the values of widgets in the repeater row, each row will default to the state it was authored in. And when any change is made to the repeater (add row, update row, filter, etc.), the entire repeater redraws from scratch, setting each row to its authored state, which in your case is an empty dropdown.

The Item Loaded event is triggered just before each row draws, allowing you to make changes to each row through code before the row displays.

So what you’ll need to do is this:

  • When the user chooses from the dropdown, you’ll want to write that choice to a column in the repeater.
  • In Item Loaded, you will set the dropdown to that saved value

It definitely feels more complicated than it should be, especially since you need to use a local variable for something as simple as this.

This article may help in understanding how best to deal with the repeater.

I’ve updated your file as an example.

Add Object Dynamically.rp (49.3 KB)

[Edit] By the way, once you have this set up, it’s easy to make a new row show up with the dropdown preset to whichever value you want. Just set the column I referenced above to the desired value in the Add Row command.

1 Like

This makes perfect sense and is exactly what I needed. Very grateful.

The article did help as well.

Thanks again!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.