How to Reset Scroll to Top of GroupFocus?

I have a repeating group that, when an item is clicked, a groupfocus window pulls out from the right and displays the data - that record can potentially be very long, so that the user has to scroll down within the groupfocus.

The problem is that, when the user clicks out of that window, and clicks another record, the groupfocus window pulls out from the right and the scroll bar leaves off where the user scrolled in the previous record, instead of scrolling to the top of the record.

First thought is to include in your workflow when they click an item the first thing could be to “Reset GroupFocus”.

If you’ve done that or something similar I’d try something with the height of that group focus.

An idea would be to make that group fairly small (say 300px) and click " fit height to content". The idea with this “height” is that when the value in the group focus is empty, it should go back to this small value of 300px height and “reset” the scroll bar. You’d need to make sure at some point between clicking elements the window is reset. It could be a workflow that "when condition is true - GroupFocus is not visible. reset Group Focus" So when they click out of the group, it’s not visible, and then has no value inside, and goes back to it’s 300px height.

Tried both of those - didn’t work :frowning: The scrollbar isn’t getting reset.

You can do this with some Javascript. To use Javascript, I recommend the Run javascript action in the Toolbox plugin.

You’ll need to set the GroupFocus’s ID, and then try this line of Javascript:
document.getElementById("ID HERE").scrollTop = 0;

I did test this with a regular group and it worked, but I wasn’t able to test on a GroupFocus

2 Likes

I don’t know much about javascript - am I putting this element on the page with the script?

So you would use an sction whenever you’d need to bring it back to the top. Such as when a button is clicked, there is a workflow action called Run Javascript that would be used here

1 Like

Ooooooohkay. Gotcha. I was trying to figure out where to paste the javascript, but there’s an actual box in the workflow to paste it. I have not encountered that before, haha.

THANK YOU! IT WORKS!

2 Likes