Marked Rows?

repeater-widget

#1

Can someone please explain how Marked Rows works in the Datasets for Repeater? I have no idea what it is or how to effectively use it.


#2

Hi Jo Anne - A person would want to mark rows, because it allows you to then delete or edit the row. I have posted an example which can give you an idea of how this works.

Essentially, OnClick of the checkbox, the row is marked. From there, you use another button in your design to “Remove Marked Rows”.
RepeaterMarkedRowsExample.rp (58.8 KB)


#3

Thanks Paul! I riffed off yours to create a variation. It’s an autocomplete that is not case sensiitive. When you click to select an item to fill the text box it’s marked in repeater. Add another adds another text box and deletes the marked row so there’s no duplication. Enter a, b, or c (or A, B, or C) in the text box.
ABC repeater.rp (63.7 KB)


#4

so now that I understand marked rows, what if I want to add items from one repeater to populate another or let the user edit a row? I’m thinking to add an item from one repeater I have to somehow find the item, mark the row, copy the values for each column in the selected row into variables, then add a row into the 2nd repeater, copy the variable values into the column values for the 2nd repeater, then what? Do I somehow mark the rows in a blank repeater the update it? I tried looking at the Cool Cart example but couldn’t quite figure out the flow since the columns were identically named in both repeaters.


#5

Hey Jo Anne,

You’ve almost got it. You don’t need to mark any rows in your target Repeater–simply use the “Repeaters -> Datasets -> Add Row” Action to add a row to the target Repeater that uses the Variable values you’ve loaded.

Another approach: you can actually do what you’re describing without using marked rows or Variables! The catch is that the control–the thing the user will click in order to perform the action–has to be inside the Repeater itself. So there are a couple of options here.

Please check out the attached RP file for a couple of examples. The first one is the simpler method and the second one is the more complex method that allows you to have an “add” button that exists independent of the Repeaters.

Hope this helps!
TwoRepeatersTest.rp (101 KB)


#6

Thanks Kip. Your solution is exactly what I was looking for. I noticed when I selected Add Row the dataset name for the “From” repeater was not showing up in the list of variables (I had them named differently in each dataset). When I manually changed the name it worked perfectly. This might be something you’d want to change in a future release so I’ve attached my file for reference.

Thanks,
Jo Anne
fruit test.rp (62 KB)


#7

Thank you for the explanation about marked rows. It has made the repeater even more useful to me now!

I have a follow-up question though: is there a quick way to mark all rows in a repeater? Something similar to: Mark “[[ALL]]” in Repeater

My goal is to empty a repeater before adding new items to it. Therefore, I’d like to mark all rows, and delete marked rows, before adding.

Kind regards,

Liang


#8

Hey Liang,

Try putting just the word “true” (or “True” or “[[true]]”, or “[[True]]”), without quotes, into the “rule” field. This is the method we’ve implemented for referring to all rows in a given Repeater. This will be officially documented in the, erm, official documentation. Just as soon as we write it!

Hope this helps.


#9

Thanks! That worked perfectly!

Another follow-up question now: is there a way to access a widget within a repeater, from the outside? (or from another instance / “database row” of the same repeater)

Example: I have a repeater with a rectangle, placeholder, and a checkbox. I would like to “update” the state of the checkbox from outside the repeater (so I would need to let Axure know exactly which instance of the checkbox should be (un)checked).

Update (solution): Found the solution in another thread (with this exact problem): http://www.axure.com/forum/v7-beta-repeater-widget/8112-set-repeater-widget-selected-using-interaction.html


#10

Okay, I’ve broken my brain against this too long and I need to ask a question here… How do you build a condition off of whether things in a repeater are marked?

I’m trying to learn repeaters by building a task list, so what’s happening is I’m adding a bunch of items that I then need to check off and hit a Complete button. If NOTHING is checked, one thing should happen. If AT LEAST ONE REPEATER ITEM is checked, a different thing should happen and the marked items should disappear.

So far I can see no solution to this problem that does not involve variables, math, and/or hidden checkboxes.

Halp!


#11

Hi Fred: It depends on what you need. Are you just wanting to mark rows and then delete those rows when you hit Complete? If so then you just Mark them as you go (maybe with an On Click event) then have an On Click event for your Complete Button to Delete Marked Rows. (If nothing is marked then nothing is deleted). If you want something specific to happen when you don’t have any marked rows, then you have to test for that (see Kip’s post above). Does this help?


#12

The deletion part works just fine. But I want something specific to happen if NO repeater items are marked, and that’s where the problem is. There’s no Rule field in the condition builder, nor is there access to repeater elements through the fx UI. I can build a condition off of whether a checkbox that is part of the repeater item is checked, but the problem with that is that it only looks at the item that was added last. E.g., if I add three tasks, the correct behavior only happens if I have the third task I added checked. Here are my conditions:


To play with this yourself, go here and add a few tasks:
Untitled Document

Any input would be appreciated!


#13

:slight_smile:

@fred_beecher: It is almost similar to what I am struggling with (see question above), but then reversed: you’re trying to get information from within a repeater (“exactly which row was checked”). Whereas I am trying to select / activate the checkbox in a specific row of the repeater.

Your problem, however, is probably solvable with a workaround by using a global variable that keeps track of the number of checkboxes that are checked. If this global variable is 0, then you show the “error message”, otherwise, you complete/delete the marked rows. Here’s the post about a counter: (Answered) Creating a counter, value of variable increases when checkbox is selected and sets text on panel. (counting, count, addition, subtraction)


#14

Yeah, I’ve thought about that, but repeater items have no “OnUnload” event. So once a marked item is deleted, the global variable will have an erroneous value. Unless deleting an item also somehow triggers the OnCheckedChange of the checkbox.

Does it?


#15

Your delete action is an OnClick event: just reset the global variable back to “0” for this event.


#16

That won’t work unless I delete ALL the repeater items, which is not always the case.


#17

Clicking the submit button without selecting a fruit gives an error. If at least 1 is selected the marked rows are deleted
fruit test condition.rp (60.7 KB)


#18

Thanks, TallGal, but sadly that doesn’t work either. I had to go in and add the [[Selected2 + 1]] to onchecked if checked, and vice versa. THEN it works… once. And it doesn’t work anymore.

Honestly, I think there are three things Axure could do to solve this problem:

  1. OnUnload events on repeater items. Then we could use the variable strategy we’ve been talking about.
  2. Add nested logic (okay, this is part 1 of a two part question)
  3. Add the ability to build a condition off of when ANY item in a repeater is in a particular state or ALL items in a repeater are in a particular state

#19

I do not really understand why resetting the global variable wouldn’t work. I’ve just taken another look at your prototype and don’t follow your answer:

Selecting (any) task: GlobalVar +1
Deselecting a selected task: GlobalVar -1
Clicking the [complete] button:
case 1: if GlobalVar == 0, give error message
case 2: if GlobalVar > 0, delete row and set GlobalVar to 0

I edited tallgall’s .rp file, and as far as I know, this is the solution I think you are looking for (you don’t need to delete ALL repeater items for it to work, and also, selecting, and then unselecting, still works. Try it out): fruit test condition - updated.rp (58 KB)


#20

Coming back to this after a long diversion…

The issue is that the repeater in question is a master with five instances on the current page, each in a different state of a dynamic panel (because I’m old [school?] and that’s how I roll). Because the repeater is in a master (and it really needs to be a master), the global variable trick will get messed up if I check X repeater items in the instance on state 1 and Y items in the instance on state 2.

Otherwise, you’re right, all the solutions you offered above will work. I just tend to be highly modular in my prototyping.

F