Scroll to Widget from Repeater to Repeater


#1

I’m guessing it can’t be done based on this topic:

But I thought I would confirm anyways. I want to use a Repeater - Card for a navigation menu and the content that it navigates to, but I can’t figure out how to do it.

I have setup a Case where if text on Menu Heading equals text on Content Heading, Scroll to Widget Content Heading, but it only works for the first menu choice.

EDIT: Added correct attachment to avoid future confusion

RepeaterToRepeater.rp (3.7 MB)


#2

There are no repeater widgets in your file, so the post title is misleading. If you did use repeaters, the solution could use the same basic approach, but the location references would need to be a bit different to calculate the vertical position of a target row within the target repeater.

While you cannot programmatically scroll the contents of a dynamic panel, you can move them to simulate a scroll. See Page 2 of this updated file for a demonstration:
scrolling within dynamic panel.rp (76.9 KB)

In the tree nodes I changed your **Scroll To Widget" actions to Move actions. Each has this interaction code:

Move
ET Content to ( , [[-LVAR1.top]] ) linear 500ms

…where there is a blank value for the x-dimension —thus no horizontal movement— and where LVAR1 points to the associated section heading. The .top parameter is a built-in variable representing the location of the top pixel (it is equivalent to .y which I could have used instead.) A minus sign proceeds the “LVAR1” pointer so the dynamic panel moves up instead of down–with the result being the section heading moves to the top of the screen (or technically the top of the “outer” dynamic panel, which I added and named “ET Pane” to keep things tidy.)

For example, the fx or “Edit Value” code for the “Section 2” tree node looks like this:

To create more section links, just copy and paste the Click or Tap interaction, then update the LVAR1 pointer reference, e.g., from “Section 2” to “Section 3”.


#3

Sorry, that was my fault for attaching the wrong file. Here is the correct one with my trying to use the Move action instead.

RepeaterToRepeater.rp (3.7 MB)

It still doesn’t work, but I’m assuming that’s because I’m not setting the LVAR1 variable to the correct value, since I am using a dynamic repeater and not a static menu.


#4

You can use the card repeater to move an invisible “anchor widget” inside the dynamic panel and then use the “Scroll To” interaction to scroll the panel to that widget.

Set the card repeater to check each time an item is loaded to see if the text on the anchor widget matches the name of the card, if it does, it moves the anchor to the top of that card. When you click an item in the “selection” repeater, it sets the text on the anchor to the item name, refreshes the card repeater, waits a few milliseconds, and then scrolls to the anchor widget after it’s moved.
RepeaterToRepeater.rp (9.1 MB)


#5

That is exactly what I was looking for. Thank you!


#6

Is there a way to do this without having to refresh the card repeater? I have checkboxes in the repeater that lose their value when it’s refreshed.


#7

A repeater can’t “remember” anything that isn’t stored in or activated by that repeater. You’ll need to add an “IsSelected” column in the repeater and set that row item to “true”, then use the repeater’s OnLoad action to set the check box to “selected”/“unselected”.

In a similar vein, I was working on one of my projects and found another way to scroll to a widget inside a repeater without needing a separate “anchor” widget. Just like setting the check boxes, you add a “ScrollTo” column that’s set to “true” when you click a selection. The repeater then scrolls to whichever row has that value. You have to set the “ScrollTo” value back to “false” each time the repeater scrolls.

Unfortunately, I can’t post the actual .rp file because it’s too big, but here are some screen shots that should help:


closed #8

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.