Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui.dialog not being re-created #1734

Open
marek-mihok opened this issue Dec 5, 2022 · 0 comments
Open

ui.dialog not being re-created #1734

marek-mihok opened this issue Dec 5, 2022 · 0 comments
Labels
bug Bug in code ui Related to UI

Comments

@marek-mihok
Copy link
Contributor

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

  1. 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()
  1. Group by column
  2. Select any row(s)
  3. 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) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in code ui Related to UI
Projects
None yet
Development

No branches or pull requests

2 participants