-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Adding new props to the data editor for exposing grid selections #6028
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
Adding new props to the data editor for exposing grid selections #6028
Conversation
Greptile OverviewGreptile SummaryThis PR adds comprehensive grid selection capabilities to the DataEditor component, enabling developers to track and control cell, row, and column selections through the Glide Data Grid library.
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant DataEditor
participant State
participant GlideDataGrid
User->>DataEditor: Clicks/selects cells/rows/columns
DataEditor->>GlideDataGrid: Selection event triggered
GlideDataGrid->>DataEditor: on_grid_selection_change(GridSelection)
DataEditor->>State: Updates grid_selection state variable
State->>DataEditor: Re-render with new grid_selection
DataEditor->>DataEditor: reconstructGridSelection(selection)
Note right of DataEditor: Converts Python dict to<br/>CompactSelection objects
DataEditor->>GlideDataGrid: Pass reconstructed GridSelection prop
GlideDataGrid->>User: Display updated selection state
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, no comments
CodSpeed Performance ReportMerging #6028 will degrade performances by 3.5%Comparing Summary
Benchmarks breakdown
|
|
can you provide an example of using grid_selection and on_grid_selection_change? |
Hi @adhami3310, If we used it inside a normal state, then it might be ok, but the reality of how complex these tables are means that its best to be contained inside a componentstate and we don't understand how we are able to get the values out of the componentstate as events cant take other events as arguements and accessing variables inside the state does not actually seem to work as the docs say. Effectively we have a basevar inside the componentstate (current_grid_selection) that stores the grid selection, and our preference would be to pass in an event to the state that exports those values out to the exterior state when the selection changes, however because of the way the component works, submission of selection is fired before the state is updated which means it fires the last selection not the current. We have also tried to follow the docs inside component state to access the var inside the component state but get a ton of errors about incorrect types even though its rx.var to rx.var. Here is where we are at, any help on how to do this would be much appreciated. usage code example: Component code: |
Add Grid Selection Props and Event Handler to DataEditor
This PR adds comprehensive grid selection capabilities to the DataEditor component, allowing developers to track and control cell, row, and column selections.
New Props Added:
Selection Control:
range_select: Controls range selection modes ("none", "cell", "rect", "multi-cell", "multi-rect")
column_select: Already existed, allows column selections ("none", "single", "multi")
row_select: Controls row selection modes ("none", "single", "multi")
Selection Blending:
range_selection_blending: Controls how range selections coexist ("exclusive", "mixed")
column_selection_blending: Controls how column selections coexist ("exclusive", "mixed")
row_selection_blending: Controls how row selections coexist ("exclusive", "mixed")
Selection Behavior:
span_range_behavior: Controls how cell spans are handled in selections ("default", "allowPartial")
State Management:
grid_selection: Controlled state prop for the current selection (columns, rows, and current cell/range)
on_grid_selection_change: Event handler that fires when selection changes, passing the current GridSelection object
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission: