Repeater/Dataset Documentation (API, Item, TargetItem, Variables)

repeater-widget

#1

Hi all,

I came across this list of Repeater/Dataset variables (or functions?) when editing a formula.

Could someone explain what these are and how to use them, or point me to a resource that does that?

Cheers!


How can i get the ""Items per page"" variable of a repeater?
Repeater with Autofill Search Help
Trying to dynamically scroll to new data in a repeater on update
#2

I’m not sure what the difference is between itemCount and dataCount. Both seem to reflect the number of items in the repeater.

The Repeater refers the repeater widget itself.

The others are useful if you have a paginated view:

pageCount is the total number of pages (total items / items per page)
pageIndex is the current page
visibleItemCount is how many items you can see at the moment

This file may help give you a feel for it.

Jeff
repeater properties.rp (119 KB)


#3

Just a small clarification:

visibleItemCount: Items currently shown (in current Filter and on current page if multiple pages)
itemCount: Items in the current Filter
dataCount: All Items in the Dataset including Items not shown or currently filtered out


#4

Hi All,

I decided to dive a little deeper into the new repeater “API” options. Through trial and error I was able to identify what some of the items do (in blue), but I have questions on others (in red and orange). I was hoping that someone in the community has answers before I get them through continuous testing :slight_smile:

I am particulary interested in the “is…” test methods and how they are executed. Also, I noticed that some of the options (“is…”, “item…”) are only avaiable for certain repeater actions and not others. Have you identified what controls the availability of said options?

Thanks for any info you can share on this!

light_forger

PS: .x/.y, .width/.height and .bottom/.top seem to be working fine on repeaters!




#5

I am going to merge this with a similar thread, you should see your questions about “repeater” and its properties answered above.

Item Properties
Your image includes Item and its properties as well. This means you are in a Repeater or an Action that acts on a Repeater. Item is the current Item you are working with. So if you do Set Text of Shape to [[Item.Name]] in OnItemLoad of the Repeater each Shape in turn will be set to its corresponding rows “Name” column.

The properties after Item are executed on an item.
index: Gives the corresponding index of the Item in the Repeater (similar to the row, but Sorts, Filters and Pagination matter)
is_: Returns “true” or “false” representing whether the Item is first, marked, visible, etc…
repeater: returns the parent Repeater of this item which can then in turn use the Repeater properties that follow it.

Repeater Properties
There are 2 ways to access Repeater properties.

  1. From inside a Repeater do [[Item.Repeater.visibleItemCount]]

  2. From outside a Repeater or referencing a different Repeater. In the expression (fx) editor, set a Local Variable (myRepeater) to a Repeater Widget. Then use [[myRepeater.visibleItemCount]].

Item vs TargetItem
This was posted elsewhere, but probably fits better here. The distinction between Item and TargetItem.

Item: Used to reference the current Item you are working with. Only available inside a Repeater. This is the most common.

Example: Set Text of Button Shape to [[item.Column1]] of the Data Set.

TargetItem: Used to reference an item that is Marked or in another Repeater.

Example (using Marked Rows and Interaction - Repeaters -> Datasets -> Update Items):
(on a click copy my data to another Marked Item) use Item
(on a click copy another Marked Item’s data from one Column to another) - use TargetItem

You can also use TargetItem to reference Items in another Repeater or from outside a Repeater.


Trying to dynamically scroll to new data in a repeater on update
#6

Thanks Ian! I don’t know how this thread slipped through. I was just reviewing the Repeater forum today :slight_smile:


#7

Jeff,
Thanks very much for the example. It’s very clear.

And through the example, I’ve also found a solution to something I was puzzling over - how to refer to different repeaters in the same page in the formulas.


#8

Hello Ian,

can you please be more precise about “2. From outside a Repeater or referencing a different Repeater. In the expression (fx) editor, set a Local Variable (myRepeater) to a Repeater Widget. Then use [[myRepeater.visibleItemCount]].”

I’m trying to show the number of items in a repeater in the actual page and it seems that your solution fits to my need.

Thanks for your answer.


#9

Is there any way to directly access, from outside the Repeater, the marked rows as well as find the index of a row based on a string using a Local Variable assigned to the Repeater?


#10

I reached out to Axure support and found out that we do, in fact, need to trigger an event to refresh a Repeater to get data out of it so we can’t just use a Local Variable, it seems. The way I did what I needed was to trigger a Remove All Filters event on the Repeater, then put logic in the OnItemLoad event within the Repeater to get any necessary information.

It’s not ideal, in my mind, especially when the DOM of browsers allows such easy access to objects. But that’s how it works! It’s not the worst. It is what it is.


#11

For those who’d like to dig a bit deeper into this, I can also recommend the advanced Axure training package that I’ve been working on, where Javascript functions, expressions and properties related to repeaters are discussed in great detail.

I’ve spent a large amount of time doing lots of research and testing on these topics and did my best to explain them thoroughly but in plain language, I hope my work can be useful to others as well.


#13

Sorry, I know this is an old thread. I’m wondering if anyone else has tried this advanced training? @Luca_Benazzi, I looked at the demo/preview. My concern is that it’s not going to go into depth enough on any topic. Repeaters are really what I’m looking for in depth. Javascript would be helpful, but only if it helps me use it with existing JS code (as I don’t know JS).

Anyway, anyone who has downloaded the training?

Thanks.

-g