Replies: 2 comments
-
Hi @msiwik-epruf , Just to understand this properly, do you mean to delete everything and create the elements fresh based on the logic? Then we can simply I put the container below the initial label and select, so that it does not jump up after creating the elements. from nicegui import ui
ui.label("Pick main option:")
ui.select(["A", "B", "C"], on_change=lambda e: update_selects(e.value))
container = ui.column()
def update_selects(choice: str):
container.clear()
with container: # ensure new selects go into the container
if choice == "A":
s = ui.select(["A1_option1", "A1_option2"], label="Select A1")
elif choice == "B":
s1 = ui.select(["B1_option1", "B1_option2"], label="Select B1")
s2 = ui.select(["B2_option1", "B2_option2"], label="Select B2")
# if choice == "C": do nothing (no new selects)
ui.run() But if I understood wrong, please let me know. Thanks, |
Beta Was this translation helpful? Give feedback.
0 replies
-
You could also use |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
First Check
Example Code
Description
This is super hacky way which still does not works as expected. Goal is to based on one selected value from first select generate more ui elements (ui.select, ui.checkbox etc.) based on selected value. And after this value changed unnecessary elements should be gone.
NiceGUI Version
2.24.1
Python Version
Python 3.11.1
Browser
Chrome
Operating System
macOS
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions