Update Widgets in Repeater

All-

A couple of you have said that there are ways to hold widget information in columns (or other) inside of a repeater, allowing the data to stick when you add a row.

I’ve made a simple repeater with a few widgets (Text Box, Drop List, Check Box).

Would the gurus among you please show the technique that you use? I have found some random examples, but it would be cool to have the answers all in one place. In most cases, if a suitable solution is found for a given example, the thread ends. It would be nice to get more than one solution idea here.

If such a post already exists, please let me know.

Cheers.

-g

RepeaterWidgets.rp (50.4 KB)

1 Like

Hello again!

I still have a “note to self” to go back and reply on that other post… (sorry!)

I normally do two things:

  1. Use the data in the repeater to set the text or selected option of the widget, and
  2. Use an “Update Rows” action to set the data in the repeater row whenever the user interacts with one of the widgets in the repeater.

For your example, for the text box, I would update the row OnLostFocus, and set [[Item.TextBox]] to be “text on widget” for the text field:

(Note that in your example file, the “Set Text” action in the OnItemLoad event was attached to the rectangle, so I moved it to the text field):

For the droplist item, you can add an “OnSelectionChange” event that updates the repeater row to be whatever the user selected…

…then, in the OnItemLoad event for the repeater, use the “Set selected option of” action, instead of the “Set text” action, and set it to [[Item.Droplist]].

For the checkbox, I usually use a column called “Selected” or something like that, and then set the value to y or n. If the box is checked, set it to “y”, if the box is not checked, set it to “n”.

Then, add a conditional case in your repeater that says "if [[Item.Checkbox == ‘y’]], set selected checkbox to true.

Note that since the box is UN-checked by default in your repeater, you only need one case to check the box. The rows that aren’t checked will “uncheck themselves” when the repeater refreshes. You CAN add both cases, but you don’t need to.

Here’s the sample file, with a few edits:

RepeaterWidgets_modified.rp (57.3 KB)

You can see that when you add a row now, all the data “stays” inside the previous rows, because now we’re using the repeater data to set all the widgets in the OnItemLoad event.

Hope that helps!

-skb

2 Likes

Sorry - a few days late.

As always, thanks for the help and great explanations. I will say that the “on lost focus” action is disappointing in that it actually requires an extra click for the user. Without that interaction, you can go directly from the text box to, say, initiating a droplist. With that interaction, when you click on the droplist arrow, it does nothing (except, technically, “change focus” from the text box).

Regardless, a great set of solutions given the Axure defect. I’m glad I added the three different types because they all have some nuance.

Cheers.

-g