Comments (14)
I second that. I think that is the reason for row selection not working in the latest release either. It works ok in v0.3.4.
if grid_response['selected_rows']: currentSelection = grid_response['selected_rows'][0] st.session_state.currentSelectedFile = currentSelection
grid_response['selected_rows'] does not contain the selected row dataframe.
from streamlit-aggrid.
@PablocFonseca - thanks for looking into this so quickly. You are correct be the dot notation, however, the returned response does not contain the selected row/s dataframe like it use to. Of course selection.selected_ids gives the address of the selected row that can be used to get to selected df values as a workaround but the backward compatibility still breaks. The problem I faced was not the dot notation but the lack of response dataframe.
from streamlit-aggrid.
I am also encountering an error in the latest version with row select. Specifically, when trying to call the selected row from the grid response, I am getting AttributeError: 'list' object has no attribute 'items'
.
Can confirm that this error does not happen in v0.3.4.
from streamlit-aggrid.
I am also encountering an error in the latest version with row select. Specifically, when trying to call the selected row from the grid response, I am getting
AttributeError: 'list' object has no attribute 'items'
.Can confirm that this error does not happen in v0.3.4.
yes its works in v0.3.4
from streamlit-aggrid.
I can confirm the behaviour as well. It seems like the grid_response.selected_rows doesn't get fully populated. The property grid_response_rows_id on the other hand has the selected rows id indexes. Is the above behaviour intended?
It currently breaks the existing implementation, therefore I have stay at version 0.3.3
I hope this gets fixed soon.
from streamlit-aggrid.
On v.1.0.0. I changed the response object, so items are accessed via dot notation instead of brackets.
I'm moving response processment from Javascript to Python side, to improve performance. It broke backwards compatibility.
I added some code on v.1.0.1 to enable backward compatibility, by returning with brackets notation for some props.
from streamlit-aggrid.
I'm having an issue where the table is ignoring rowSelection = 'single'
. The return value is still the single selected row, but the table "adds" a selected row without de-selecting the previous row (as far as visuals is concerned)
I'm using checkbox selection
from streamlit-aggrid.
@PablocFonseca - After the recent update to 1.0.2 the data gets populated to selection dataframe. - Great!
Therefore, after implementing it with the rot notation I ran into another issue.
The response data has different columns based on whether at least one row was selected. In case, no row was selected, the output is just an empty dataframe.
This circumstance makes it necessary to always run a check like
if gridresponse.selected_rows.empty then pass else gridresponse.selected_rows["Column1"].to_list()
Maybe it would be beneficial to keep the dataframe structure identically to avoid such extra checks.
from streamlit-aggrid.
@robingie I agree it makes sense.
So, do you think its better to return a DF with columns and no rows, or None?
from streamlit-aggrid.
@robingie I agree it makes sense.
So, do you think its better to return a DF with columns and no rows, or None?
I would vote for None as No Selection = None and makes it easy on downstream logic.
from streamlit-aggrid.
@PablocFonseca
As for my current use cases, I would prefer having an empty data frame with all the columns available.
Most of the time I have to extract some ids from an id column or another reference and store it in a list for further processing. An empty list will cause no issue when you iterate over it.
Alternatively, None as a return value requires to catch it separately and can be quite bothersome depending on how much processing you do with the response.
Usually, I have to iterate over the selected records. With the new data frame some extra logic needs to be added over it. But I guess it's fine so that we stay consistent. On the other hand, if you just depend on a single allowed selection return None might be more feasible.
from streamlit-aggrid.
But breaks the backward compatibility for 10s others which should make this an unpopular choice and unwanted hassle to discover that the selection return logic has changed. Just my penny worth!
from streamlit-aggrid.
I believe the previous behaviour was to return an empty list, which would behave similar when testing for None.
I'll double check previous version returns and try to keep backward compatibility.
I'll also add convenience methods to AgGridReturn, so we can try to have best of both solutions.
from streamlit-aggrid.
I updated the data and selected_data behaviour on v 1.0.3-2:
They have identical return formats, except one return only selected rows and other all data.
I also included a property to deal with rowGroups
Live example here https://staggrid-examples.streamlit.app/Selecting_data
from streamlit-aggrid.
Related Issues (20)
- Browser tab hangs when (async) refreshing streamlit pages HOT 3
- Implementation of getGroupRowAgg callback for multiple columns HOT 1
- Add Tooltips when Hovering on Cells or Headers HOT 2
- Can't pickle local object 'GridOptionsBuilder.__init__.<locals>.ddict' HOT 1
- [Q] Can I get the selected cell position (row & column) from the response object? HOT 2
- Width statement in columnDefs of grid options is ignored HOT 3
- Question/improvement: How to realize what event from grid occurs? HOT 4
- Show Ag-Grid Version HOT 1
- Reselect of rows on re-runs doesn't work HOT 1
- Resource Warning
- aggrid with fastapi request HOT 2
- GridResponse not updated on rowdrag HOT 1
- pre_select_all_rows not functional
- The phantom event appears after st.rerun()
- AttributeError: module 'streamlit.components.v1' has no attribute 'components' HOT 1
- Is there a text column filter? HOT 1
- How to implement quickfilter after enable_quicksearch is deprecated?
- Can aggrid add a row of cells?
- [Question] Why Altair is <5?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamlit-aggrid.