Get Custom State from Reusable Element within Repeating Group

I’ve seen a number of forum posts on this topic without any reaching or providing a resolution, and am posting my problem as I can’t accept there isn’t a workaround. It’s definitely a needed requirement, and for sure seems like it should be achievable.

I have an RG that needs a focus group (the sub-menu in the image below), and since RGs don’t like to have their own focus groups, I’m pretty sure I’m committed to using a reusable element:


Ironically, the sub-menu functions that navigate to a different page (Profile and Message) both work wonderfully. But the annoying Filter On and Compare functions take place on the same page as the RG and should just set a custom state that the page can access. But no cigar!

Solutions tried:

  • Set a custom state on the main page from within the RE. But I can’t do this as the RE doesn’t have access to the main page.

  • Have a “Do when” condition on the main page, but the main page doesn’t have access to the RE because it lives inside the RG.

  • Have a when element is changed/clicked/caressed on the main page, but I can’t do this as the RE is within the RG.

Any help is greatly appreciated.
SerPounce

1 Like

I am assuming the menu is the reusable element that you have placed into the R.G. that is an element on a page.

Seems like you want to have an ability to do what? Filter on and Compare functions are performing what task and using what elements? Are those tasks performed on the page or in the R.G. cell of the currently selected menu (Reusable Element)? Are the elements used to perform the tasks on the page or in the R.G.?

Thank you for the response.

Yes, the RE is within the RG.

Filter on will filter the RG based on the User who created the post. So a function within the RG.

Couldn’t you put the user as the custom state on the reusable element, and then set the R.G. data source to use that custom state as part of it’s filter?

RG data souce equals “do a search for users” with constraints user = this posts creator…you may have the user custom search set when something changes on the reusable element.

Couldn’t you put the user as the custom state on the reusable element,

Re the above: yes, no problem

and then set the R.G. data source to use that custom state as part of it’s filter?

Re the above: Not possible as the RE is not accessible from the page because it is within the RG.

To be a wee bit clearer:

  • A page’s custom state within an RG is accessible to the page (of course).
  • An RE’s custom state on a page that isn’t within an RG is also accessible to the page.

BUT… An RE’s custom state within an RG can not be accessed from the page.

This is the problem I am trying to solve.

@SerPounce, the non plugin way to do this is through url parameters. Have your Filter On sub-menu navigate to the page your RG is on (this will be the same page as the RE when it’s actually used) and pass a parameter of ‘filter’ with the value of ‘on’.

Then simply access the filter state with a Get data from URL action. Works perfectly.

The other option is to use one of the global variable plugins available as they will pass data across reusables and pages.

Edit to add: You can pass things (i.e. your user) as a parameter as well by sending the unique id.

2 Likes

Could the RG be a RE?

So the menu is an RE, then make another RE which has the R.G. which you then place the RE ( menu )…set up the custom states appropriately…then I believe the page should be able to get the custom state from the menu by way of the RE which is the RG

The issue is that you can’t access a specific cell’s state from outside a repeating group, otherwise he could just set the state on the root of his menu reusable. Adding another reusable into the mix is another layer of complexity without solving the problem.

I use both URL parameters and the ‘Env’ plugin extensively for this very purpose and it works flawlessly.

1 Like

Thank you all for the suggestions.
@eli, quick question before I embark on my journey of discovery to solve: Does the URL parameters option require reloading the page? If so, this won’t be a viable option due to load time.

@SerPounce from my understanding from the new changes from the hackathon just released the page doesn’t reload which is a benefit of using the URL path and parameters…also the sudsy plugin gives clean URLs without needing to reload the page

No, as long as you are navigating to the same page you are on all the ‘page is loaded‘ events will be triggered but the page itself isn’t reloaded so it’s instantaneous.

2 Likes

This isn’t a new feature. Getting the paths as a list just makes it more useful :wink:

Damn, I always assumed it would require a reload. That’s awesome info!!

2 Likes

Yes, I think now we can get a path as list so we can have clean URLs such as myapp.com/products/shirts/men/small/page_1

so that we can navigate between pages ( different pages of R.G. set up for pagination ) without needing to reload the page and enable the user to use the browser back button instead of needing to use on page elements for navigation between R.G. for pagination.

I think before the new feature to allow multiple paths it wasn’t possible to extract individual paths from a list of them, or am I misunderstanding it and we can only extract the entire “list of paths” with the recent update?

@eli @boston85719 thanks again for all the fantastic guidance. I’ve got the process working now using ENV variables from the bdk. Not sure at this point if I’ll experiment in time with the URL parameters.

2 Likes

I wish you had experimented with the URL because I am planning on doing it myself. As mentioned in your previous threads I had also purchased the ENV variables but used it only once and @eli suggestion of URL parameters was not available to me at that time.

One of the things that I had a problem with the ENV variables and a lot of the other “hidden” plugins is that they obstruct responsive design unless you are very considerate of where you place them, and sometimes I’ve experienced the placement needed to avoid interference of responsive design caused the plugin element to not function.

I personally will be experimenting with the URL as I need it for onboarding flows, but also want to make use of it for search results.

ok… I hear ya. I’ve got some other development that has to take priority for the mo, but will try and get to the URL shortly. Especially if you’re keen to go through the learning in partnership, will likely go quicker and more effective if we share as we go.

@SerPounce (and anyone else)
you can do this for free using active cell plugin by @lottemint.md
Although it takes some extra steps compared to env plugin.


the “…” button is reusable element. inside of starred repeating group

3 Likes

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