S
Solara6mo ago
rob-vh

process results of a field change to another element level

I would like to trigger python code each time one of the input fields in a page is updated, the result of the python code should be shown in a message box at Page() level. https://py.cafe/rob.on.lists/solara-markdown-message-editor I know how to display a reactive variable in a field on Page(), when it is changed/set in another element, but I can't get my mind around triggering python statements. Should I propagate the on_value condition from the propagate() routine up to MarkDownEditor elements in Page()? How do you propagate conditions?
PyCafe - Solara - Solara-based Markdown Message Editor
Run, Edit and Share Python Apps in Your Browser with 1 click!
1 Reply
rob-vh
rob-vhOP6mo ago
I now have a component with a dynamic number of input fields, each input field contains an on_value callback to update a top-level dict with the field names and the change made to the field. The "inventory counts" are in a dict and I save this into a reactive value after each update to the dict. I have the reactive value in my call to solara.DataFrame, but only the first change is reflected in the output of Page(), subsequent changes are made to the reactive value, but not displayed: https://py.cafe/rob.on.lists/solara-inventory-editor-only-works-first-time Is this related to https://github.com/widgetti/solara/issues/245 Since I have to massage the data anyway, before displaying, I changed the logic to use a simple counter as reactive value. The reactive field is just a dummy parameter that only causes the DataFrame element to be re-evaluated and rendered. https://py.cafe/rob.on.lists/solara-inventory-tracker-using_dummy_reactive Is there a more "reactonic" way to trigger the Page() to evaluate and render the DataFrame?
Want results from more Discord servers?
Add your server