Accessing a variable on another form without using get_open_form or self.parent

Here is another option: use this DataGridJson custom component and you don’t have the problem at all.

Your problem is accessing components on the form from a repeating panel template form.
If you use the DataGridJson, you don’t have row template forms (well, you do, but they are created under the hood for you by the custom compoent).
And you don’t need to define the custom events (well, you do, but the custom component does it for you).

You add the custom component, define the columns by specifying what columns have buttons (links in my implementation) and what callback function to use when those buttons are clicked, define the callback functions in the main form, right there next to everything else and everything is cleaner.

The advantages are that you don’t need to define a row template form, you don’t have code in two forms and you don’t need to manage the communication between the two forms.

The disadvantage is that the row template form is defined automatically for you and it may not be flexible enough. If you are lucky it’s good enough for you, if you are less lucky, you may be able to improve the custom component so it includes all the features you need, if you are less less lucky… you will need another of the options listed above.

1 Like