wave
wave copied to clipboard
ui.dialog not being re-created
This issue is similar to #1687 but the fix (#1724) is provided on the table level. It would be great if there is also fix on the level of rendering and creating of meta cards.
Wave SDK Version, OS
Wave 0.24.0
Actual behavior
When ui.dialog is re-assigned to q.page['meta'].dialog it is is re-rendered, but not re-created.
Expected behavior
The ui.dialog should be re-created including all its children similar to form card.
Steps To Reproduce
- Run the app:
from h2o_wave import main, app, Q, ui
columns = [ui.table_column(name='text', label='Column 1', sortable=True)]
rows = [
ui.table_row(name='row1', cells=['Row 1']),
ui.table_row(name='row2', cells=['Row 2'])
]
@app('/demo')
async def serve(q: Q):
if not q.client.initialized:
q.app.rows = rows
q.page['meta'] = ui.meta_card(box='')
q.page['meta'].dialog = ui.dialog(title='Table', width='800px', items=[
ui.table(
name='issues',
columns=columns,
rows=q.app.rows,
groupable=True,
height='600px',
multiple=True,
),
ui.button(name='remove', label='Remove selected', primary=True)
])
q.client.initialized = True
elif q.args.remove:
q.app.rows = [row for row in q.app.rows if row.name not in q.args.issues]
# This should recreate the whole dialog including all its children so the table should be rendered as reset, with initial state (no-group by).
q.page['meta'].dialog = ui.dialog(title='Table', width='800px', items=[
ui.table(
name='issues',
columns=columns,
rows=q.app.rows,
groupable=True,
height='600px',
multiple=True,
),
ui.button(name='remove', label='Remove selected', primary=True)
])
await q.page.save()
- Group by column
- Select any row(s)
- Click on the Remove selected button
Table should be reset to initial state but it is not.
It is worth to note that other metas (e.g. side panel) could be impacted by the same issue. Also note that example provided won't reproduce the issue in newer Wave versions (after merging #1724) .