Forum Academy Marketplace Showcase Pricing Features

Show more button to expand RG

Does anyone know how to have a repeating group which is initially limited to 3 rows, but when a button is clicked, it reveals 6 rows … and again, click the button again and it shows 9 rows, like below?

You can set a state on the page, something like item_count of type number.

Then in the repeating group data source use items until # → have it reference the item_count state

Then on your Show more button, just update that state with something like +3

Screenshot 2021-07-13 at 22.16.36

1 Like

Thank you, I have tried this but I can’t find items until in the data source (see below). Is there a chance you could show me a bit more step by step instructions?

Also, could you help me with how to set up the custom state. I assume I need to put the custom state on the RG which needs to ‘showmore’. I have set that up but then where do I refer to the state? I have 8 events cards showing and when the button is pressed I want to show 8 more …

Items until# should appear on the dropdown anytime a list is being referred to. In your screenshot you’re looking in the wrong place - you need to apply it to the datasource, so click the ‘more’ button after the ‘Search for Groups’ in the data source (you’re specifying the ‘items until’ of the returned list of groups - nothing to do with the search constraints).

Also, could you help me with how to set up the custom state. I assume I need to put the custom state on the RG which needs to ‘showmore’. I have set that up but then where do I refer to the state? I have 8 events cards showing and when the button is pressed I want to show 8 more …

You can put the custom state wherever you like, as long as you can remember where.

Often, it’s simpler just to put all custom states directly on the page itself, so you know where to find it, but you can put it on the RG if it makes more sense to you (I often do this).

You then refer to the custom state in the data source.

i.e. Search for Groups: Items Until (custom state value)

Then when the ‘Show More’ button is clicked, set the state to its current value +8

(you might want to hide the ‘show more’ button once all the items are displayed, in which case just add a conditional to the button, to make it not visible when the custom state value is equal to, or more than, the total number of items.

Ah, thank you I have found the Items until#.

I added a custom state (called item_count) directly on the page itself but I can’t see it when referring to the custom state in the data source.

Here’s the custom state:
custom-state

and here I am trying to find the custom state value.

This feels complicated because the button ‘load more’ has an option to add a custom state, so I’d then have 2 custom states.

Another question is, should I set the RG layout style to ‘Full list’?

As a test, I have set the RG to Search for Groups: Items Until #1. I did this to see if it shows 1 row or 1 event card. However, it still shows all the events so I’m obviously doing something wrong here.

You have to refer to the element it’s on first (in your case the page itself). So Search for Groups: Items until: my page's item_count

This feels complicated because the button ‘load more’ has an option to add a custom state, so I’d then have 2 custom states.

I’m not sure what you mean by that? You don’t need 2 custom states for this, so you don’t need to add any more than the one you’ve got.

Another question is, should I set the RG layout style to ‘Full list’?

You don’t have to but it probably makes sense to if you’re using a ‘show more’ button.

As a test, I have set the RG to Search for Groups: Items Until #1 . I did this to see if it shows 1 row or 1 event card. However, it still shows all the events so I’m obviously doing something wrong here.

Yes, that shouldn’t be happening - so you’re either doing something wrong, or perhaps there’s bug, but without seeing more it’s hard to say.

Thank you, I have now referred to the custom state in the data source .

list

Despite setting the default value to ‘1’ I still see ALL groups.

I see what I was doing wrong, the button was not referring to the index page custom state so it was asking me to create a new one. I have now added the workflow to the button (below) but of course nothing works because the RG is always displaying ALL groups.

Another side issue, I am also trying to add a custom state so that a button will show events happening ‘today’. You gave me advice to add a custom state to achieve this in this post but I can’t figure out how to add 2 states to the RG data source (it just won’t let me). I’ll update the thread above to keep issues separate.

Something’s not right then.

I see you’ve got 2 conditionals on the RG. Do you have different data sources for those conditions for the RG?

Those two conditionals are both for the dropdown to select a town. I needed one condition to show all groups in all UK areas when the dropdown is defaulted to “Select town”.

But, annoyingly, after you have selected a town from the dropdown, the default “Select town” disappears and you have an empty space, so I added “All UK” to the dropdown which explains the second identical conditional.

Is there a chance you could see what’s happening from your end if I gave you access?

Yeah, sure I can take a look when I get a chance, but it sounds is though that’s the problem.

You’re probably better off not using any conditional data sources if possible (as it can lead to complications like this) and doing everything directly in the search constraints.

But if you give me access I can take a look.

Fantastic thank you! How do I give you access without opening it up to the public? I had a disaster the one and only time I set the site to public, some idiot jumped in and wrecked my site for “fun”.

Just set it to ‘read only’ for now so no one can edit anything, but I can take a look.

Ok that’s done :slight_smile:

I have made progress! I set up a new test page and got the ‘show more’ function working. I think the issue I am having on the main homepage is with the dropdown conflicting with the ‘show more’ button. I’ll have a look at applying custom states to the dropdown tomorrow and see if I can get it working better - but thanks for your help thus far!

UPDATE: It works! The default “Select town” dropdown references items until# item_count but when you select “All UK” from the UK it no longer references the custom state and simply shows all.

1 Like

This post was flagged by the community and is temporarily hidden.