Replies: 1 comment 1 reply
-
Hi @adosikas, thanks for these suggestions! from nicegui import observables, ui
@ui.refreshable
def show_list():
for item in my_list:
ui.label(item)
my_list = observables.ObservableList(['A', 'B', 'C'], on_change=show_list.refresh)
show_list()
ui.button('Add item', on_click=lambda: my_list.append('X'))
ui.button('Remove item', on_click=lambda: my_list.pop()) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was designing a form that needed an array of complex objects (which would use
ui.expansion
orui.menu
), and after looking at the todo list I was playing around with ways to make this more accessible.Before submitting a PR I would like some feedback on what approach would be best.
The array would also be bindable (as value).
Basic concept ("callback variant")
Alternative ("decorator variant"), similar to
ui.refreshable
Alternative ("subclass variant")
5 votes ·
Beta Was this translation helpful? Give feedback.
All reactions