Three repeater questions

repeater-widget

#1

Hi there,

First post so please be gentle.

  1. How do you address a specific row / column combination from outside the repeater using either local or global variables. - most important…

Failing that…

  1. how do you assign a row as marked from outside the repeater - after copying and deleting a row to another repeater, i want the row above to become marked and assign the text contained within that row to other objects with it’s row data. I have assigned a global variable to the current index… but then can’t use that because it stores it as an integer, not a real reference to the repeater… so you then can’t affect/set the repeaters index with it.

which leads me to ask…

  1. how do you set a repeaters index from outside the repeater, ie falsify where the user clicked on the repeater…

For Example -

When the user clicks delete on a mail message it removes the message - this works fine
The repeater containing the list of mails updates and moves the message to the deleted box - this also works fine

The repeater then populates the body/details view of the message (object external to the repeater ) with the previous mail (the one above) in the inbox - this is the bit i can’t get to work…
I also want the previous mail (one above) to be “marked” or selected as part of the delete, so the user can then delete it without first clicking on the repeater…

because from what i can tell, you cannot address a specific row (like you could with an array) within a repeater from external to the repeater, or by any other way than if the user clicks on that row so you can call Index.

I was expecting my delete button to have something like this in it’s onclick

set the text of ExternaltextObject to repeatername.indexnumber.columnname
Mark repeatername.indexnumber = true

I have tried using global variables and setting them to the repeatername, then addressing the variable but because there’s no detailed documentation on exactly how the scripting works in axure it’s been very much trial and error. Also tried setting the repeater to a local variable, then setting that local variable to a global variable, and addressing the global variable both to read and set index.

So yes… please do help if you can.

Cheers
Justin.


Repeater - need SUM with inline edit
How to access the item number of the selected repeater item
#2

add a widget inside the repeater,
lets call it repeater-listener.

from outside set a global variable to the desired index,
move the listener (all are moving).

in the on move event add a case with the condition: if global variable == repeater.index.

now you can execute whatever code insise the repeater from the outside.

when you move a row store this rows index in a global variable,
reduce the global variable by 1,
mark row where(global var == index)

if you dont know the rows index you can do a search with the repeater.listener:

store a unique value (id, product-number, name… whater) in a global variable.
add a case with a condition to the listener:
if repeater.item.product-number == global variable -> other global variable = repeater.item.index

at this point you can add a widget outside to confirm the result.

confirmationwidget.moveBy(0,0)

confirmationwidget.onMove(){
other global variable --;
// here you have the index to do whatever you want
}

you have a wrong understanding of the repeater index. the index is a individual number for each item. outside the repeater it can’t have a single value becaus all values exist at once. additionaly after each repeater action (add, remove, sort, filter) the repeater is redrawn and the index for a row might change.
finally the repeater.listener is your friend. there is an additional problem, you wont face it in your actual project but sooner or later you might run into it:

you are not able to move sibling listeners from inside the repeater. in this case use a widget outside: onMove(){repeater.listener.moveBy(0,0)}… just as a re-routing.


#3

Hi Gregor,

Firstly thank you, i’ve been through number one and now understand it.

Just to summarise my understanding of this and as i’ve read your similar posts before on the forum, and not understood it until now.

This essentially is firing a faked move event from a normal page interaction. That event burrows into the repeater widget being moved and allows you to attach repeater commands to the widgets on move script… hence accessing attributes of the repeater not normally available outside of the repeater.

I hope you don’t mind but here’s my laymans version.

So if you click on a button in a page, it triggers the dummy move of widget (moving it by 0,0) in the repeater.
Then in the OnMove script is kicked off on the widget in the repeater
What ever internal function of the repeater you want to access goes in the OnMove script.

If you click the Fx button you can see from the OnMove script that you have access to all of the repeaters attributes, hence knowing that it’s internal to the repeater and giving access. Clever.

Going to read the rest and digest today.
Cheers
Justin


#4

I build a step by step introduction to the repeaterListener concept.

Untitled Document
repeaterListenerLessons.rp (781 KB)


closed #5

unlisted #6

listed #7