I’ve read and re-read questions on this topic, the best thread was hobbled by the original poster’s inability to share the app. I’ve created (and shared) a simplified example in the hope that it aids those in a position to render assistance.
Problem
I have an app based on the modified material design theme. On the “Homepage” I have a left nav-bar with links, and a main content panel (column panel). When a user clicks on one of the left nav-bar links, the proper form is loaded into the the main content panel. In this structure, I believe the Homepage is always going to be my get_open_form(), form.
On one form (OPTION1) I have a datagrid that displays data from a simple table that has two fields, country and river. The repeating panel has a delete icon allowing a user to remove an entry from the table. The form, OPTION1, that hosts this datagrid/repeating panel, has a label that displays the number of Rivers held in the table. When a user deletes a river, the table correctly is updated using self.parent.items=anvil.server.call(‘GetRivers’)
What I cannot figure out is how do I communicate from the data row panel, the delete link, back to the form that holds the datagrid, that the number of rivers displayed, needs to be updated.
Clearly, the sample app will much more clearly communicate the problem.
Your description of how to do this is likely exactly what I need. As I read down through your github writeup, I modified my sample app to reflect exactly what you were describing, it seems so simple. However, I got the error 'NoneType object has no attribute ‘raise_event’…
And then of course I read the last note/caveat which seems to speak directly to that, that I am trying to access the repeating panel the row template is in… too early.
Even after reading a lot of posts and docs, I guess I don’t understand the form_show event well enough to get this to work. In the attached clone app I’ve put in some debugging print statements, etc.
I think you’re saying that the form show event for the RowTemplate1 form has to occur, and then self.parent would be instantiated instead of being None?
I think the problem is that you are triggering a “refresh_data_bindings” with the line right before you try to raise the event:
self.parent.items=anvil.server.call('GetRivers')
The effect of this may be to remove the old/original row item from the repeating panel so that it no longer has a parent. I got it to work by moving this line to the Form2 function called by the event. (You also need to add **event_args to that function.) https://anvil.works/build#clone:IQ367UPVIIC6XPJF=JQW42HKU7WU32EREA3DG5THA
…note that using parent, as noted in the linked posts, can be brittle if the structure of the app ever changes. I usually keep direct references to the components I want to interact with to avoid that potential issue.