I am trying to nest a data grid inside another data grid in code.
In the form’s init I create the first (outer) data grid and define its columns. I the create a repeating panel, set its items property and add it to the outer grid.
Next I create the second (inner grid and define its columns.
How do I add this grid in the second column of the first?
Code Sample:
def __init__(self, **properties):
# Set Form properties and Data Bindings.
thelist = anvil.server.call('createdatastructure')
outergrid = DataGrid()
outergrid.columns = [
{'id':'A', 'title':'Event', 'data_key':'Event', 'width':200},
{'id': 'B', 'title':'Y/Ns', 'data_key':'YN', 'width':200},
]
self.add_component(outergrid)
outergridrepeatingpanel = RepeatingPanel(item_template=DataRowPanel)
outergridrepeatingpanel.items = thelist
outergrid.add_component(outergridrepeatingpanel)
innergrid = DataGrid()
innergrid.columns = [
{'id':'C', 'title':'Name', 'data_key':'Name','width':'50'},
{'id':'D', 'title':'Y/N', 'data_key':'YN', 'width':'50'},
]
self.init_components(**properties)
Clone link:
share a copy of your app