Recipe to set Select values dynamically? #3463
-
I'm trying to implement a Select component whose values are not hardcoded but loaded dynamically. My frontend code is as follows:
while my backend is like this:
No matter what I try I can't get the Select to show the values that I have loaded into the State. By debugging I see that Am I approaching this the correct way or is there another way or dealing with this kind of problem? EDIT:
while my backend is like this:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@thomastiotto take a look at our select docs to see how to bind your select to state. Your code can be simplified to be class State(rx.State):
values : list[str] = []
def load_values(self):
self.values = ["a","b"] and rx.page(on_load=State.load_values)
def symbols() -> rx.Component:
return rx.select(State.values) |
Beta Was this translation helpful? Give feedback.
@thomastiotto take a look at our select docs to see how to bind your select to state.
Your code can be simplified to be
and