Skip to content

Commit

Permalink
🚀 create a selected_visible_cell_iterator property
Browse files Browse the repository at this point in the history
this allows users to use the SelectionHelper on visible data only
  • Loading branch information
jgunstone committed Apr 29, 2024
1 parent 23b6287 commit f2f159b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ipydatagrid/datagrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,11 +760,11 @@ def selected_cells(self):
return SelectionHelper(
self._data, self.selections, self.selection_mode
).all()

@property
def selected_cell_values(self):
def selected_visible_cell_iterator(self):
"""
List of values for all selected cells.
An iterator to traverse selected visible cells one by one.
"""
# Copy of the front-end data model
view_data = self.get_visible_data()
Expand All @@ -776,10 +776,14 @@ def selected_cell_values(self):
view_data_object = self.generate_data_object(
view_data, "ipydguuid", index_key
)
return SelectionHelper(view_data_object, self.selections, self.selection_mode)

return SelectionHelper(
view_data_object, self.selections, self.selection_mode
).all_values()
@property
def selected_cell_values(self):
"""
List of values for all selected cells.
"""
return self.selected_visible_cell_iterator.all_values()

@property
def selected_cell_iterator(self):
Expand Down

0 comments on commit f2f159b

Please sign in to comment.