How to update ui.select options? #32
-
Hello, How do you update ui.select options and update the view to user? in justpy it was async to: select1.on('input', updatelist)
async def updatelist():
select2.options =(list2)
jp.run_task(wp.update())
await asyncio.sleep(1) How do you make it in nicegui? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I can clear the select2 and write it again (with new options) with callback function, but is there another way? |
Beta Was this translation helpful? Give feedback.
-
Since NiceGUI 0.8.0 @rodja's answer requires an explicit UI update:
|
Beta Was this translation helpful? Give feedback.
-
Aforementioned are not recommended anymore because Instead, choice elements like |
Beta Was this translation helpful? Give feedback.
Aforementioned are not recommended anymore because
view.options
no longer represent theoptions
the user passed toui.select
.Instead, choice elements like
ui.select
,ui.toggle
andui.radio
now haveoptions
that can be modified. Callingelement.update()
will update the internal data model and synchronize the new options to the client.