When the number of rows in table is small and `reload_data=True`, the selection doesn't show up in UI
See original GitHub issueWhen the number of rows in the table is small and reload_data=True, the selection doesn’t show up
Minimal example to reproduce:
import streamlit as st
from st_aggrid import GridOptionsBuilder, AgGrid
import pandas as pd
csv_url = (
"http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv"
)
df = pd.read_csv(csv_url, sep=";")
df = df.head(28) # HERE!!! when set to 29, it's working
st.title("Not showing selection example")
gb1 = GridOptionsBuilder.from_dataframe(df)
gb1.configure_selection(selection_mode="multiple", use_checkbox=True)
gridOptions = gb1.build()
response = AgGrid(
df,
gridOptions=gridOptions,
width="100%",
update_mode="SELECTION_CHANGED",
reload_data=True,
key='example',
)
print(response['selected_rows'])
The row that is selected is printed but you can’t see it in the UI
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
UITableView.reloadRows does not re… - Apple Developer
I created a tableview using custom cell. I want reload the target cell, let's say [section = 0, row = 0], and use...
Read more >Retain selection on reload - DataTables example
To demonstrate Select's ability to retain the selected rows over a data reload, select a number of rows and then click the Reload...
Read more >How to remember rows selected and maintain them after ...
I want to select a row , take the number of selected row with indexpath.row and then reload the table and select the...
Read more >Table | Components - BootstrapVue
index will not always be the actual row's index number, as it is computed after filtering, sorting and pagination have been applied to...
Read more >Table - Ant Design
A table displays rows of data. ... default no select dropdown, show default selections via setting to true . ... The small size...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This workaround works, congrats you figured it out!
@PablocFonseca my issue is not a ‘question’ I think.
@smolendawid, a workaround for your issue is to set the “key” argument of the AgGrid widget depending on your filter settings. For example you could just append your settings to a string. In this way it will not reuse the old one and create a new table when the settings change.