-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dynamic select input #524
Comments
This idea is very cool I thought of something like: |
Another option would be for us to render the select with Kino, but then it may feel a bit "out of place". What are your thoughts here @jonatanklosko? |
If we render it with Kino, then the select state will be lost whenever we reevaluate the cell, which would be quite annoying. Regarding implementing it as regular input, a couple things to keep in mind. We need to get the new value whenever someone changes the source variable or when the cell is reevaluted. Also, the evaluator may be busy for a while, so there's also an intermediate loading state. It's definitely doable, but handling all of this seems a bit tricky, while this particular input is more of a convenience. Say we really need to handle dynamic values, then we could do: values = ["a", "b", "c"]
# --- Answer: [input] ---
value = IO.gets("Answer: ") |> String.strip()
if value not in values do
raise "expected either of #{inspect(values)}, got: #{inspect(value)}"
end This also matches what someone would do in a script, which is sort of our point from the beginning. With this in mind, the gain of dynamic select is not clear to me and sounds like an overkill, but feel free to convince me :D And as a minor detail, it could be a bit confusing that we take the options from a variable, but then still return a newline-terminated string. |
I understand your point of view, I'm thinking of some solutions to the issues raised in this conversation, for now I'll leave this task on stand by. |
The idea of dynamic select came from presentation mode: you may want to parse some data and then generate selects for the user to customize graphs, reports, etc. Here is an example from deepnote: https://deepnote.com/@fs/Programatic-input-values-QAIvOZdTQyiFARcEBxVaEA I am sure it will be needed at some point but I understand the implementation is likely non-trivial. As you said, in a lot of ways it behaves more like an Elixir cell (e.g. it can go stale too). |
I imagine that for the user to customize graphics, reports, etc. be really very good. (although there are several details to consider in implementation) |
Maybe I'll do some sketches 🙂 |
I have discussed with @jonatanklosko and we are moving all inputs to Kino. This should make this really feasible. So keep posted. :) |
A dynamic select input is one that gets its possible values from a variable name in the code.
The text was updated successfully, but these errors were encountered: