What I’m trying to do: Please reference the screenshot below to follow along with the following ordered-list:
Link “Case Dashboard” is clicked (screenshot item #1)
self.main_container (screenshot item #2) is populated with form Panels.PanelCaseDashboard()
nested link “Events” is clicked (screenshot item #3)
Here is my issue - the center container located within Panels.PanelCaseDashboard() (screenshot item #4) , named self.cd_container, will not populate with another form. I guess I am trying to access a child within a child? (not sure)
What I’ve tried and what’s not working: I’ve tried using get_open_form(), but this is returning the top level form. I’ve tried the code below - I do NOT get an error, however, nothing happens. Any help is greatly appreciated.
# This is inside of a link click event
Panels.PanelCaseDashboard().panel_cd_center.add_component(Panels.PanelAgenda())
Hi. You have to link each column in the grid view with the corresponding data table column to view it. That can be done in several ways. You could bind it directly in client code, but make sure that viewing from child form is enabled on that table (cases). Or You could write a server module function to return the entries and then display these in the data grid (safer).
In case Your problem is child/parent nesting, try using parent.parent.parent.named_omponent.named_property.named_value and so on, to get to the right level above Your current child. It works, but You will have to check if it turns out right.
To use server code and then link in form, look at the documentation for grid, Getting Started (anvil.works)
You will find these code blocks:
The first block returns the whole table through search. You can access the data by inserting the last line in the second code block in Your form, linking it to Your repeating panel. And then You have to edit the grid view in Your form to display the columns,
@larstuff thank you, Lars. The datagrid is just a placeholder, no issues there. My issue is replacing the contents of the container where the datagrid placeholder rests. I’ll try the parent.parent.parent.named_omponent.named_property.named_value and see if that works. Thank you!
Yes, You can .parent Yourself up to the right level, and check (the coding is dynamic, although a little slow) if .parent. and then wait to see if one of the desired form components, from exactly the right form turns up in the drop down…
No, that is not possible, as python cannot use child, since there can be more than one child of a parent. So what You have to do, is use the name of the component in the form when You have reached the right level.
You must take one parent at a time, and check.
And only if the form is already contained inside the parent form can it be found in one of the parents. If not, I think You will have to promote the form You want to use to a component, I’ve not tried that, or I tried, and failed to understand how to use it.
Where in the code are You trying the parent stuff?
@larstuff I am trying in the link click event. I printed self.parent.parent which printed: ‘Home’ object has no attribute ‘panel_cd_center’
In layman’s terms, I am trying to change the contents of this component: Panels.PanelCaseDashboard().panel_cd_center from another form…if that makes sense?
Breakdown: Panels.PanelCaseDashboard().panel_cd_center Panels: top-level package PanelCaseDashboard(): Form within the “Panels” package panel_cd_center: component on PanelCaseDashboard() form
…now, it does nothing, no errors, no change to component, nothing. I think it’s the same as doing what I had originally done in my initial post, which was this:
The code makes sense to me, but not to python lol. I think it also has to do with what @p.colbert posted, basically, I am creating a new instance of Panels() and not updating the existing form.
agenda = Panels.PanelAgenda() # or maybe new before Panel, to invoke new instance of object
dash = Panels.PanelCaseDashboard().panel_cd_center
dash.add_component(agenda)
Strange, maybe the component needs to be refreshed or something to show new content?
It has an event called refresh_data_bindings…
Ok post new clone link