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

fix: Allow dynamic value change for checkbox #1154 #2090

Merged
merged 3 commits into from
Aug 1, 2023

Conversation

marek-mihok
Copy link
Contributor

@marek-mihok marek-mihok commented Jul 24, 2023

The PR fulfills these requirements: (check all the apply)

  • It's submitted to the main branch.
  • When resolving a specific issue, it's referenced in the PR's title (e.g. feat: Add a button #xxx, where "xxx" is the issue number).
  • When resolving a specific issue, the PR description includes Closes #xxx, where "xxx" is the issue number.
  • If changes were made to ui folder, unit tests (make test) still pass.
  • New/updated tests are included

This PR partially resolves issue #1154.

NOTE: Do not forget to update status in this comment once merged.

@mturoci
Copy link
Collaborator

mturoci commented Jul 31, 2023

Seems to not work for me, or maybe I am missing something?

from h2o_wave import main, app, Q, ui


@app('/demo')
async def serve(q: Q):
    if not q.client.initialized:
        q.page['form'] = ui.form_card(box='1 1 5 5', items=[
            ui.checkbox(name='checkbox', label='Checkbox', value=True),
            ui.button(name='toggle', label='Toggle'),
        ])
        q.client.initialized = True

    if q.args.toggle:
        q.page['form'].checkbox.value = True

    await q.page.save()
Screen.Recording.2023-07-31.at.10.05.42.AM.mov

@marek-mihok
Copy link
Contributor Author

Good catch @mturoci! I've updated my solution and test cases. Now it should be working as expected.

Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please go through the rest of your PRs and check them in the same manner. Thanks!

@mturoci mturoci merged commit 2e8b48b into main Aug 1, 2023
@mturoci mturoci deleted the fix/dynamic-value-change-checkbox branch August 1, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants