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?
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
You create a table arrangement with id=1
Inside this arrangement, you create a button with id=btn1
Now under the Any button. Click event, replace the text ‘btn’ with an empty text block from the text section in block editor.
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.