How to update pagination?

I have a standard repeater/data table with five columns and about 100 sample records. I’m trying to figure out how to set the selected state on each paginator when clicking next or previous. I understand how to do this manually but how can I achieve this dynamically?

Example screenshot:

Thanks for your help!

Not sure if I understand your question completely. What do you mean by “set the selected state on each paginator”? Are the widgets with numbers 1, 2, 3, 4, 5 your “paginators”? …And maybe you want to set “3” to Selected when the repeater page 3 is shown? It would be nice if the repeater had an event like “Page Changed” just as a dynamic panel has “Panel State Changed” --but alas it does not. But you can update the selection status of your widgets everywhere you have an action to change the page. Now that can get tedious, but there are some tricks that help a little.

It’s been awhile since I had to mess with repeater pagination, but you can refer to the [[LVAR1.pageIndex]] property to get the current page (where LVAR1 is local var pointing to the repeater.) Also the [[LVAR1.pageCount]] to get the total number of pages. …I created a little proto to test and demonstrate this. To help with selecting the correct page selection button (paginator, right?) I “hacked” the Rotated event of each to test if the current pageIndex matches it’s text, and if true, select itself (that’s one trick as I mentioned above.) So, on each press of a button (or whatever event on whatever widget) that changes the repeater page, I call the Rotated event of each paginator button (which doesn’t actually rotate them, just triggers this event.) I realized halfway through I should have made the paginator buttons a repeater also (ha!) --then I’d just need one Rotate call instead of 5 …or you can update a specific row to set it to be selected. But it should be easier to grasp the basics here without this second repeater.

Here’s the demo. if I didn’t understand your need correctly, or you have questions about the details, let me know.
repeater pagination.rp (73.3 KB)

Just in case, here are some basics… You can change a repeater page dynamically (Look for the Set Current Page action in the Repeater section of the Actions list), and you can change the number of rows per page dynamically (Look for the Set Items per Page action.)

Here is the Axure reference for Repeater Pagination:

I got motivated to make the “paginators” a repeater also. It simplifies things a good bit, keeping all the “paginator updating” in the repeater. It also allows the paginator buttons to adapt with the number of pages–so if there are only two pages worth of content, it only shows paginators 1 and 2.

Updated .rp file:
repeater pagination.rp (135.1 KB)

  • Page 1 is my first solution

  • Page 2 moves the control of paginators inside the repeater

    • It occurred to me that each time the repeater’s page is changed the Item Loaded event fires.
    • So you just need to trigger the “paginator update” one time in this “Item Loaded event chain” (it gets fired once for every row in the dataset.) You can use either the [[Item.isFirst]] or [[Item.isLast]] to ensure the update happens only once per page change.
    • It also shows how the repeater can update the item count, “X-N of Y” rows.
  • Page 3 uses a repeater for the paginator buttons.

    • The Content repeater updates the appropriate row in the Paginator repeater: the row that matches the current pageIndex. It also takes care of enabling/disabling the previous and next buttons.
    • The “Rows per page” droplist sets the items per page in the Content repeater, and filters the rows accordingly in the Paginator repeater, using this filter rule:
      [[Item.Num <= LVAR1.pageCount]] (LVAR1 is a local var pointing to the Content repeater.)
    • The Paginator repeater is in a dynamic panel set to “Fit to Content” so that as the number of possible pages changes, it will shrink and grow automatically as well as move the Next button with it.
    • If you need to add rows to the Content repeater, you could fairly easily add rows to the Paginator repeater as needed, making solution this scalable.
1 Like

Thank you, mbc66, for your help with this! And thank you for the help you’ve continued to provide me over the years, too, btw. A few years ago I started this thread and you were so helpful and I learned a lot from you. Thank you.

I will take a deep dive into this over the weekend and post back. I’m sure I’ll learn a lot!

Thank you,