Skip to content
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

Clicking a row in streamlit 0.84 causes a TypeError #22

Closed
msabramo opened this issue Jul 3, 2021 · 4 comments · Fixed by #23 or tonylegend/streamlit-aggrid#1
Closed

Clicking a row in streamlit 0.84 causes a TypeError #22

msabramo opened this issue Jul 3, 2021 · 4 comments · Fixed by #23 or tonylegend/streamlit-aggrid#1

Comments

@msabramo
Copy link
Contributor

msabramo commented Jul 3, 2021

Upgrading to the newly released streamlit 0.84, if I click a row in the grid, I get a TypeError exception:

  File "/Users/abramowi/python/virtualenvs/AppenUploader-UHtnTuBj/lib/python3.8/site-packages/st_aggrid/__init__.py", line 173, in AgGrid
    frame = pd.DataFrame(component_value["rowData"])
TypeError: string indices must be integers
@msabramo
Copy link
Contributor Author

msabramo commented Jul 3, 2021

I'm taking a look to see if I can create a PR to fix this...

@msabramo
Copy link
Contributor Author

msabramo commented Jul 3, 2021

In streamlit 0.83, the plugin gets a value for component_value which is a dict.
In streamlit 0.84, the plugin gets a str, which looks like the same data, encoded in JSON. I don't know if this change in streamlit was intentional or accidental.

msabramo added a commit to msabramo/streamlit-aggrid that referenced this issue Jul 3, 2021
In Streamlit 0.84, `component_value` is a `str` with JSON-encoded data,
rather than a `dict` as with previous Streamlit versions.

Added a check for `str` and if it's a `str`, we decode the JSON into a
`dict`.
@msabramo
Copy link
Contributor Author

msabramo commented Jul 3, 2021

This PR fixes the issue: #23

@tonylegend
Copy link

Good catch. I met the same problem and your fix works for me. @msabramo

@PablocFonseca Thanks for building this excellent component. Hope your next release could catch this fix to the lastest Streamlit changes.

tonylegend added a commit to tonylegend/streamlit-aggrid that referenced this issue Jul 11, 2021
PablocFonseca added a commit that referenced this issue Jul 29, 2021
Fix GH-22 (TypeError with Streamlit 0.84)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants