wave: Trigger for ui.checkbox and ui.toggle not triggered on unselect

Q SDK Version, OS Q 0.3.1 OS: macOS 10.15.6

Actual behavior

When using trigger=True on ui.checkbox and ui.toggle, selecting an option creates trigger with the component name in q.args. However, when an option is unselected, q.args is empty.

Expected behavior

Expected behavior is have the q.args with the name of the component that is unselected and the value to be False.

Here is the log from my app. checking the checkbox created green_zone but unchecking it did not create any args

initialized: True
route: before:dashboard, now:None
args:
green_zone

initialized: True
route: before:dashboard, now:None
args:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

For anyone stumbling upon this issue in future: Simply update items instead of redrawing the whole card.

@lo5 I had a bug. I fixed it. but now I am getting what @mturoci is getting.

checkbox_bug

I am redrawing the entire form_card now. It looks like if I just update the items, it will work as expected.

For simplicity, checkbox.py modifies the page using page['example']=, so the page is marked as dirty.

To optimize this, it could simply modify the .items of the form_card, like in wizard.py.

Correct. My point is I am not sure if it should be dirty at that point since no cards were added / deleted.

Sync’s round-trip to server wants to override example card in checkbox.py example and replace it with the initial state. That’s why the page is marked dirty.

Callstack after clicking on checkbox with trigger: image

@lo5 todo.py works as expected. I am reviewing my code for hidden bugs.