Skip to content

Data table selections should persist across DataViews #7199

@halocline

Description

@halocline

Expected Behavior

When using DataTable's onSelect with Data, my selections across views should be persist and accumulate as I change my view and make additional selections. For example, I should be able to:

Scenario 1

  • Alter my data view - for example's sake, let's say the view returned 7 unselected records.
  • Use the select all control in the table's header.
  • Total selected should be 7.
  • Adjust my view again, this time returning 5 unselected records.
  • Select all in the current view.
  • Total selected should be 12.

Scenario 2

  • Alter my data view - for example's sake, let's say the view returned 7 unselected records.
  • Use the select all control in the table's header.
  • Total selected should be 7.
  • Adjust my view again, this time returning 5 records (3 selected + 2 unselected).
  • Select all in the current view.
  • Total selected should be 9.

Scenario 3

  • Alter my data view - for example's sake, let's say the view returned 7 unselected records.
  • Use the select all control in the table's header.
  • Total selected should be 7.
  • Adjust my view again, this time returning 5 records (3 selected + 2 unselected).
  • Select all in the current view.
  • Total selected should be 9.
  • Unselect all in the current view.
  • Total selected should be 4.

Actual Behavior

Currently, my previously selected records are not retained after changing view and then selecting all. Instead, the previously selected records are replaced with my new selections.

URL, screen shot, or Codepen exhibiting the issue

Screen.Recording.2024-04-11.at.1.22.47.PM.mov

Steps to Reproduce

  1. Modify the Data/SpaceEx story by adding select and onSelect.
  2. Select all
  3. Change view by selecting another page or applying a new search or filter
  4. Select all again

Your Environment

  • Grommet version:
  • Browser Name and version:
  • Operating System and version (desktop or mobile):

Metadata

Metadata

Assignees

Labels

Data and friendsFor data components in grommetDataTableDataTable related issuesbugissue that does not match design or documentation and requires code changes to address

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions