Open
Description
Description
As noticed in #1869 (comment), when creating AG Grids on currently hidden tabs, they don't get mounted and interacting with them can cause problems:
with ui.tabs().classes('w-full') as tabs:
one = ui.tab('One')
two = ui.tab('Two')
with ui.tab_panels(tabs, value=one).classes('w-full'):
with ui.tab_panel(one):
async def get_data():
ui.notify(await grid.get_client_data())
ui.button('Get data', on_click=get_data)
with ui.tab_panel(two):
grid = ui.aggrid({
'columnDefs': [{'headerName': 'Name', 'field': 'name'}],
'rowData': [{'name': 'Alice'}, {'name': 'Bob'}],
})
When clicking "Get data" before visiting tab "Two" for the first time, a JavaScript error occurs and we don't see a notification.
How can we make sure every NiceGUI element is created, even if it is hidden on another tab?
Related discussion: #2157
Activity