Question: Select with value and label
Hello!
I'm pretty new to pynecone and don't know if it is possible, but I have a list of ids and associated names, and I would like to crate a select where the name was displayed but when the option was selected the value would be the associated id (or an object with name and id, but just the id would do). Looking on the documentation I could only find examples where the label and value were the same.
How could I do this? Is it possible? If not, is this feature in the pipeline?
I don't think it is possible at the moment.
Though it should not be too complicated to find the id from the value. Assuming you have
options = [(1, "Option A"), (2, "Option B")]
You can define :
options_name = [opt[1] for opt in options]
options_rmap = {opt[1]: opt[0] for opt in options}
We will bring some improvements to the select component in the future, but until them you should be able to make do with the code above.
I'd second this and try to get it more visibility somehow. Without being able to handle lists of key/value pairs of data this functionality is not particularly useful beyond trivial scenarios. A separated option/value item list for select and multiselect is needed quickly
This is possible now in the low-level select.