Clicking a Button trigger the Dropdown @on handler. #1885
-
Wave SDK Version, OSWave SDK: 0.24.2, OS: MacOs Actual behaviorWhen clicking the Screen.Recording.2023-03-10.at.21.07.36.movfrom h2o_wave import main, app, Q, ui, on, handle_on
@on()
async def dropdown_handle(q: Q):
q.page['notification'] = ui.form_card(box='1 3 2 1 ', items=[
ui.button(name='notification', label='Notification', disabled=True),
])
await q.page.save()
@app('/demo')
async def serve(q: Q):
await handle_on(q)
q.page['form'] = ui.form_card(box='1 1 4 2', items=[
ui.button(name='breadcrumb', label='Label'),
ui.dropdown(name='dropdown_handle', label='Dropdown', choices=[
ui.choice(name='name1', label='label1'),
ui.choice(name='name2', label='label2'),
ui.choice(name='name3', label='label3'),
ui.choice(name='name4', label='label4'),
]),
])
await q.page.save() Expected behaviorNeed separate @on handlers for |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This works as expected and the bug is likely in your code depending on what you'd like to achieve. A button click will submit all components on the page. So in your example, the button click submits the dropdown and its corresponding function is executed when a dropdown value is selected (not Depending on what triggering events you want to capture, you can define several |
Beta Was this translation helpful? Give feedback.
-
My bad. I apologize for any confusion caused and understand that I raised the wrong issue. Thanks for your clarification. |
Beta Was this translation helpful? Give feedback.
This works as expected and the bug is likely in your code depending on what you'd like to achieve.
A button click will submit all components on the page. So in your example, the button click submits the dropdown and its corresponding function is executed when a dropdown value is selected (not
None
).Depending on what triggering events you want to capture, you can define several
@on
functions for different triggers.