question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When the number of rows in table is small and `reload_data=True`, the selection doesn't show up in UI

See original GitHub issue

When 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:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
smolendawidcommented, Feb 4, 2022

This workaround works, congrats you figured it out!

@PablocFonseca my issue is not a ‘question’ I think.

0reactions
thunderbug1commented, Jan 31, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found