Get the Parent Component/ Layout of a Button?

Hi ,

Is it possible to get the Parent Component / Layout in which a Specific Button is in?

Like I have a Table arrangement with 30 buttons. I want to use a Any Button. Click event to do something with only the buttons in the Table Arrangement.

One way to do it is use a is in list block, but that would take too long to make the list…

So is there any workaround by getting the Parent component?

Explain ur problem

I’m not facing any problem, I was just asking if there is a workaround

One way to do is, using the Dynamic Component extension by @yusufcihan

For example,
You can create a table arrangement with suppose id= 1. Now inside that table arrangement, you can create a button with suppose id= btn1.
Now under Any Button. Click event, you will get the id of the clicked button. Here for example, button with id= btn1 is clicked, then now just replace the text ‘btn’ from the button id which will have only ‘1’ left with you, which is in-turn the id of the table arrangement in which the button resides.

Summary :point_down:

  1. You create a table arrangement with id=1

  2. Inside this arrangement, you create a button with id=btn1

  3. Now under the Any button. Click event, replace the text ‘btn’ with an empty text block from the text section in block editor.

  4. This will return you with id=1, which is in-turn an id of the table arrangement in which the clicked button is present.

This is the one way that I can think of. If you want, you can wait for more answer from other members. :slightly_smiling_face:


Thanks @Vaibhav

But I think It would be easier to go with making a list of buttons, as the Dynamic Components is a bit confusing for me…

1 Like

You are free to choose the method, which you feel is easy :slightly_smiling_face:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.