How to automatically scroll to last item in a repeating group?

I’ve created a chat Bot that displays a list of messages to and from ChatGPT in a repeating group.

Every time the user asks a question that question and the answer to it are added to the list of messages, so the list gradually gets longer and longer as the conversation progresses,

The repeating group doesn’t have a fixed number of rows and the list of messages reaches the point when they go beyond the end of the repeating group and the user has to scroll down to see the messages (assuming they realise that they are there).

However, depending on the length of the messages, the user may not realise the need to scroll down. So, I would like the repeating group to automatically scroll to the last item/rows in the repeating group and just cannot figure out how to do it.

Is it possible?

Thanks

Gary

You can use the Scroll To Entry workflow action.

2 Likes

Yep, scroll to entry based on that repeating group’s :lastitem would be the simplest way.

Maybe check out this too:

It reverses the RG so the newest items appear at the bottom rather than the top, and you go back by scrolling up (like how most chat boxes work). So as long as the person is scrolled to the bottom, it will always show the newest item how you would expect.

It works by flipping the whole RG upside down, and then flipping each cell’s contents upside down so they appear right side up.

3 Likes

Sorry to be dim but I’m new to Bubble…where do I find the ability to “scroll to entry based on that repeating group’s :lastitem”

I already have the messages in the right order (as they are sorted on the creation date) so I have no need to reverse them. The latest is already at the bottom but isn’t visible as it’s beyond that botton border of the window.

Scroll to last item sounds ideal but I cannot find it for the life of me!

It’s a workflow action. So you’d need a workflow that runs when a new message is posted, and then you’d select the action as one of the steps:

image

I think you’ll come to see the limitation of how Bubble updates repeating groups by default and want to use the plugin eventually though.

1 Like

Thanks. I’ve created the workflow into and for some odd reason it goes to the penultimate row but I now I have the basis of a solution.

I’ll take a look at the plugin.

I appreciate the help.

Gary

Depending where in the process you’ve got the step, it might be executing before the new item is appended (or at least before it realizes it’s there). You might need to make that action more explicitly run once the other stuff has happened.

Here is some order of operations info for Bubble if you haven’t seen it before.

2 Likes

I just wanted to say thank you for helping me resolve this. I also wanted to say what worked, in case anyone else has the same problem.

The workflow scroll to last action did the job but needed two other things to be true to make it work well.

First I needed to lift the last message off of the bottom by putting it a little bit of padding (or was it margin).

Second, ticking the “scroll animation” box on the workflow action really helped, as it seemed to force the scroll to the very last line of multi-line messages. Also, the animation makes it obvious to the user that something has happened with some visual feedback that wasn’t always obvious without the scroll.

So a bit thank you. My Chatbot factory is up and running.

Gary

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.