Mark selected items from repeater

Hi I can’t share my file so will try my best to explain.

I essentially have a list of items within a repeater with 2 data points.

Number: 1, 2, 3, 4, 5, 6, 7, 6
Colour: Red, Blue, Blue, Blue, Orange, Red, Red

This gives me

1 Red
2 Blue
3 Blue
etc

Each item has a checkbox which I have set to be marked upon selection and unmarked on unselected.

I then want to add some quick check boxes outside of the repeater to mark (highlight) the rows that meet that requirement.

For example:
Selecting the checkbox ‘[ ] Select Red’ should then check all rows that have that value.

I don’t want to remove rows from my repeater just mark/highlight items if a checkbox is checked and the individual row has that value.

Hi!

This solution uses the “listener” method for checking the rows in the repeater.

When an event – say, a click – occurs on a widget in a row, and that widget handles the associated interaction for that event (in this case, OnClick), that interaction will be evaluated for every row in the repeater, one row at a time.

Similarly, if you move a widget in a repeater, that widget’s OnMove interaction will be evaluated for each row in the repeater, one row at a time, in the context of that row. “Context” meaning that, for example, the keyword “Item” will apply to the current row being evaluated, just as it would in the OnItemLoad handler, and any row widget referenced (e.g., the checkbox) will be referenced for the current row.

Here each outer checkbox marks/unmarks the row that matches its color on select/unselect, and then moves the “listener” widget in the repeater row. The listener’s OnMove interaction is then evaluated for each row. The listener’s code looks like this:

Here’s a sample: outer_checkboxes_check_repeater_rows.rp (63.7 KB)

Thanks Joseph, exactly what I was looking for.

Final question: How would I uncheck the outer checkbox if a red value was unselected from the repeater?

Thanks again

Hi!

Unfortunately, this is more tedious. In the checkbox code (inside the repeater), you test what Item.color is and check or uncheck the associated checkbox outside the repeater:

OnSelected (of checkbox inside of repeater)
   If [[Item.color]] is equal to "Red"
      Set selected of checkbox "red" to true
   Else If [[Item.color]] is equal to "Blue"
      Set selected of checkbox "blue" to true
   ...

OnUnselected (of checkbox inside of repeater)
   If [[Item.color]] is equal to "Red"
      Set selected of checkbox "red" to false
   Else If [[Item.color]] is equal to "Blue"
      Set selected of checkbox "blue" to false
   ...
1 Like