-
Notifications
You must be signed in to change notification settings - Fork 31
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
Missing on_change parameter, key doesn't work as expected #28
Comments
I've found a workaround but still I think it would be better if the widget would behave same as the built-in widgets.
|
Hello @Mi-La, Unfortunately it is not an issue of this component, but of streamlit custom components in general. They don't support callbacks or session state binding for now. This feature was already requested on streamlit repository : streamlit/streamlit#3977 |
This is slightly related to #25.
I want to use the editor to edit a selected file on the filesystem - read at the beginning and write on any change.
With
st.text_area
I'am able to achieve this by using theon_change
callback together with customkey
.But
st_ace
doesn't supporton_change
callback and yet it's not able to read content of thekey
which I provide.The editor's content remains empty and yet the
st.session_state["content"]
is not updated on change. However, if I remove the prepared session state and only use the second line, thest.session_state["content"]
is updated properly on each change.Here is my working example with
st.text_area
:This allows me to edit the
file.txt
, update it multiple times and always have the correct content on the filesystem (and thus read the file again in another components).Thanks for any help!
The text was updated successfully, but these errors were encountered: