h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.98k stars 327 forks source link

Dropdown choice cannot be disabled when popup set to always #1959

Closed VijithaEkanayake closed 1 year ago

VijithaEkanayake commented 1 year ago

Wave SDK Version, OS

0.25.2, Mac OS

Actual behavior

The choice is always selectable irrespective of the disabled attribute of the choice being set to True when the value of the popup attribute is set to always.

Expected behavior

Choices should be disabled in the popup when the choice is disabled.

Steps To Reproduce

Use following sample code to reproduce issue.

from h2o_wave import main, app, Q, ui

choices = [
    ui.choice('A', 'Option A'),
    ui.choice('B', 'Option B'),
    ui.choice('C', 'Option C', disabled=True),
    ui.choice('D', 'Option D'),
]

choices_dialog = [ui.choice(str(i), f'Option {i}') for i in range(1, 102)]

@app('/')
async def serve(q: Q):
    q.page['example'] = ui.form_card(box='1 1 4 7', items=[
        ui.dropdown(name='dropdown', label='With Popup (Disable work)', required=True, choices=choices,values=['A']),
        ui.dropdown(name='dropdown_popup_always', label='Popup Always (Disable Not Working)', values=['A'],
                    required=True, choices=choices, popup='always'),

    ])
    await q.page.save()