Repeater change status color

hey, i have a dinamic content in my repeater. despite the different text of my statuses i want them to be different bg colors.
Find tricky to do so.

The simplest way to do this is to use a Widget Interaction Style.

Set the widget ‘selected’ state to be a red background. When you load the row, move the widget by 0,0. Then add a case on the widget itself that will check Item.Status and set the widget to the selected state. This method is limited to one ‘selected’ state. If you want to have multiple colours, you will need to use a Dynamic Panel to create multiple colours and states. You can use the same ‘move by 0,0’ trick to cause the dynamic panel to self evaluate and switch to the correct state.

hey, thanks, but how to make them multiple colors between repeater lines.
is there a way to set text color different from the rest of the rows

You can use the ‘move by 0,0’ trick to cause any widget inside your repeater row to evaluate itself and apply a widget style.

The attached file shows a simple example of this in practice.

SelfEvaluatingRepeater.rp (75.4 KB)

In the example, some text lines are set as they normally would be, using ‘Set Text’ interactions. However, the two columns of buttons are moved by 0,0.

Then, on those two buttons, they self-evaluate by using conditions on the widgets themselves to check the values in the appropriate repeater columns. The first column uses widget styles to do this and the second uses dynamic panels (to be able to handle multiple possible states).

Thank you! it worked completely.
And what about if i have dynamic time meter via different rows. There should be three color measures, 1h-30min - red (danger), 1h30min- 3h - yellow,
above 3h black. How to set different colors without losing dynamic column data?

Thank you! it worked completely.
But what if to have different colors without losing dynamic column data?
There should be three color measures, 1h-30min - red (danger), 1h30min- 3h - yellow, above 3h - black.

I’m not sure what you’re asking, but the two methods shown in my example file can be adapted to pretty much anything. Unfortunately you can’t directly set fill colours etc - you need to use either widget interaction styles (which are limited in number) or dynamic panels (which can be a pain to keep consistent with each other).

If you’re evaluating time data, you’d need to store that as a number so you can use ‘less than’ and ‘greater than’ evaluations. I’d suggest storing it in minutes. There are maths functions you can use to convert minutes to hours (as in, 90 becomes 1h 30m) but if it is just a static demo table and you won’t be updating values, I generally just use another repeater column to store the text version.

If you have more specific questions, I’d suggest uploading a version of your file. I’d also suggest this excellent video series, specifically this episode about unique content in repeater rows and this episode about targeting items in repeaters.

1 Like

Actually on re-read I think I’ve understood. Here’s an updated version:

SelfEvaluatingRepeaterv2.rp (77.9 KB)

This is using the simpler interaction styles version of this trick. If you needed multiple text colours, you’d need to make that text widget into a dynamic panel and then make sure that your set text action targeted all of the potential states of the panel and updated text in all three (or more) of them. It would be great if Axure featured a ‘Set Style’ interaction, because this way of doing things is very fiddly and fragile, but I’m afraid it doesn’t currently.

3 Likes