Button To Close Grandparent Container

I have been working on this for a while, and now I think I am just getting in my own way so I thought I would throw this out there. Forgive me if this turns out to be simple but apparently I am not braining effectively right now.

Pretty straightforward. I have a reusable element that has a button within it that I would like to first close the grandparent it is embedded within, and then replace it with another grandparent. I can’t seem to figure this out.

Can you give an example of what you’re trying to do?

Sure. I have a Master container. Within that container, I have set up a tab-like structure so that I can show 3 sub-containers, one at a time, as the user needs.

Within each of the sub-containers, there is a menu structure that brings in four different reusable elements that accomplish various tasks.

Within one of those sub-containers (grandchild of the Master container), I would like to switch tabs in the master container essentially.

Does that help?

If I understand what you’re saying correctly, the simplest way to do this will be with a Run JavaScript action, to call a Bubble-to-Javascript function on the Master container.

Just add a JavaScript to bubble element (from the Toolbox plugin) to the Mater element (make sure it’s visible).

In the Mater element, add a workflow event from that JavaScript to bubble element.

Then in your grandchild element, use a Run JavaScript action to call the function on the Master element.

Alternatively, you could do this just with custom states, but it’s a bit more complicated.

You’d need a custom state on the grandchild element, and on the child element.

Then in the grandchild element, change that custom state value.

On the child element, have a workflow event that listens for the change in grandchild custom state, and resets the grandchild custom state back to its original value, and changes its own custom state value.

Then on the Master element, have a workflow event that listens for the change in the child custom state value, sets that value back to its original value, and then caries out whatever action you need to do on the Master element.

Thank you for this. I will play around with your suggestions. Not great with javascript so I’ll try the custom states first and if that does not work then ChatGPT and I will try the javascript. I’ll report back when I figured it out or hit another wall.

1 Like