Skip to content

Commit 2a07d3f

Browse files
committed
fix selections after sorting or filtering
Signed-off-by: Itay Dafna <[email protected]>
1 parent 21a826f commit 2a07d3f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ipydatagrid/datagrid.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,16 @@ def selected_cell_values(self):
525525
"""
526526
List of values for all selected cells.
527527
"""
528-
return SelectionHelper(grid=self).all_values()
528+
# Copy of the front-end data model
529+
view_data = self.get_visible_data()
530+
531+
# New DataGrid instance with data from
532+
# the front-end data model
533+
selections_grid = DataGrid(view_data)
534+
535+
# Copying over selections from main grid
536+
selections_grid.selections = self.selections
537+
return SelectionHelper(grid=selections_grid).all_values()
529538

530539
@property
531540
def selected_cell_iterator(self):

0 commit comments

Comments
 (0)