Can "Input" values be updated from secondary inputs? #883
-
If I want to update all my inputs based on pre-baked "scenarios" - is there a way to update all values from data? This would allow users to test variables in my model, but be able to go back to predefined scenarios at the click of a button. e.g. if I have an input like this:
is there a way to modify it from a button? const reset1 = view(Inputs.button("Reset to 1")); reset1;
population = 555 Obviously reassignment like this is not allowed and throws: But is there a way to support this use case? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, but you need to declare the input as well as its (reactive) value: const populationInput = Inputs.range([0, 10000], {step: 10});
const population = view(populationInput); Then you can do something like: populationInput.value = 250;
populationInput.dispatchEvent(new Event("input", {bubbles: true})); |
Beta Was this translation helpful? Give feedback.
Yes, but you need to declare the input as well as its (reactive) value:
Then you can do something like: