Change text if Repeating Group is fully loaded

I have a RG which is set to “Ext. vertical scrolling” so that it auto-loads when users scroll. In case of a user’s slow connection, I have added some text below the RG to say “loading…”. I would like this to disappear or change to “no more results to display” once the RG is fully loaded and I wondered if there is any way to do this? I was looking at using conditions but couldn’t find a way.

Any advice would be greatly appreciated.

Thanks

Well, the loading thing is easy right as rg’s have a while loading property. So do what you want there.

For “no more results” it might be far easier NOT to use the same element.

Not in front of a machine and I’m not SURE how ext scrolling lists report their cell index values. (Test it, experiment, right? I think they are like full lists rather than fixed varieties, but FYI.)

Anyway if they are like full lists:

Put a text element in your cell that is only visible when “this cell’s index is…” the RG’s source list’s :count.

That will indicate list end, right? (Say source list is 124 things. Cell index 124 contains the last item in the list and there are no more items to display.)

It should be obvious why we put the text element in the cell. (If not, it’s because “this cell” only exists inside of the context of the RG itself.) In effect, what is happening is each cell is asking itself, “Do I hold the last available item?”

Hi Keith,

Thanks for your advice. I think I’m getting what you are saying. The issue is that my repeating group has an ever changing number of results, so I’m not able to specify a set number. The “loading” property also doesn’t work as it only works while the data is actually loading, whereas I am looking for the text to display when the ext. vertical scrolling has displayed all results??

An ext scrolling RG LOOKS like it changes. However, the RG’s list of things:count does not.

When a cell’s index is equal to the RG’s list of things count, that is the last item in the list.

1 Like

So would I be right in saying that the way to do that would be this would be the following:

-the text “loading” is set to NOT be visible on page load

-use conditional rules to display the text “loading” when a cell’s index is <= the RG’s list of things count

Would you know how I would set up the conditional rules. Can’t seem to find the right option. Specifically, I can’t find out how to reference the last item in the RGs index.

Thanks for all your help

JT

Your original question is a bit misleading and I just glossed over your misunderstanding of “loading”…

It’s not about loading. Loading is a different state. (“Loading” means “while data is being fetched and we’re waiting”…). If you have an RG that is doing fancy things in the cells, or the database is big, or the search is complex, it can take a while for the RG to update. By default Bubble throws up a spinner when that happens. But you can do OTHER things by checking for “loading”.

But that’s not actually what you’re trying to accomplish. You are trying to indicate to the user that the last item is now displayed and they can stop scrolling (or something like that).

What YOU are tying to detect is whether the last cell in the ext vertical repeating group is displayed to the user. The way to do this is to have the cell tell them. The cell knows if it’s the last item in the list (if its index is the list’s count, that cell contains the last item).

Here’s an example app (very simple) that shows everything I’m talking about:

Edit mode: https://bubble.io/page?name=index&id=am-i-the-last-item&tab=tabs-1

Run mode: https://am-i-the-last-item.bubbleapps.io/version-test?debug_mode=true

3 Likes

Exactly! Sorry, I struggled to explain it properly. Thanks so much for all your help and for the example app. I managed to get it working by following your steps there. Thanks so much again!

1 Like

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