Changing Panel State within 1 Repeater Row

repeater-widget

#1

Hi, new to Axure here but loving what it does and enjoying getting to learn it. Hope you can help with this query that i’m struggling with.

I have a repeater that contains a Dynamic Panel (panel1). The Dynamic Panel has two states - ‘default’ and ‘afterchange’.

The ‘default’ state is simply a button. On clicking the button, a separate Dynamic Panel (panel2) loads as a lightbox. This second Dynamic Panel has some text fields that allows the user to update the rows of the repeater after clicking a ‘save’ button - i’ve got this bit working fine.

What I would also like to happen on clicking the ‘save’ button is that the state of ‘panel1’ changes to the ‘afterchange’ state for the row in the repeater that has been updated. I’ve got the panel state to change to ‘afterchange’ but it does it for every row in the repeater. I can’t work out how to change just the 1 repeater row that has been updated.

Hope i’ve been clear enough and someone is able to help!


Repeater - how to manipulate only single rows?
#2

There is not a straightforward way in Axure to refer to a specific row instance in a repeater. As you’ve discovered if you do something to one widget in a repeater, it is, well, repeated for every row. Blessing and a curse. Two common methods are to trigger a “hidden” event for a widget in your repeater, or mark row(s) and update the marked rows.

The “hidden event” method typically calls an otherwise unused event for a widget in the repeater (like OnMove or OnRotate) and that event has a condition to test a row identifier (like [[Item.index]] or [[Item.Name]]) against a “target value” (like a global variable or widget text) which in turn would call your intended event (like, “set panel state”). So, if you want to show the “afterchange” state only in row 3, you could set OnLoadVariable to “3” and instead of changing the state of your panel1 dp, you could move the dp by (0,0) thus not resulting in any actual move but triggering its OnMove event. Every row’s panel1 dp will fire OnMove, and if the condition is true (like, If [[Item.index]] equals value of [[OnLoadVariable]]) then this must be the correct row (if false it gets skipped) and THEN the dp can change its own state which would only affect that row and no others.

The “mark and update rows” method requires a dedicated column in your repeater dataset (like, “panel1State”) and a condition in the OnItemLoad event that changes something in your repeater (like, If [[Item.panel1State]] equals value of "after" Set state of panel1 to afterchange). Then you can mark one or more rows, typically from some user action within the repeater (like, Mark Rows This in MyRepeater) and then update the marked rows, setting the “panel1State” column value to “after” which in turn would trigger the condition in the OnItemLoad to change the dynamic panel state only in rows which are marked.

If none of this is making sense, don’t worry, repeaters are kind of tricky. If you can post your .rp file it will be easier for forum users to modify it and demonstrate a solution.

Here are a few recent threads that could help you:


#3

Huge thank you! I went with your “hidden event” approach and got it working.


closed #4

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