Skip to content

Track DataTable row multi-selection support #6586

Description

@micrenda

Summary

DataTable currently has cursor/highlight support and single row selection events, but no native row multi-selection API.

There is user demand for this in the existing discussion:

There is also an earlier PR that explored contiguous row range selection:

I opened a new PR with a broader approach here:

Problem

Applications often need a table selection model where the cursor/focus row is distinct from the selected rows.

Typical expected behavior includes:

  • toggle one row with Space or Ctrl-click;
  • select a contiguous range with Shift-click / Shift-navigation;
  • keep discontiguous rows selected outside the current range;
  • clear selection or select all rows;
  • style selected rows independently from cursor/hover styling.

The important distinction is that the cursor means "where the user is focused", while selection means "which rows the user has chosen". They overlap often, but they are not the same state.

Prior approach

PR #3821 modeled selection as a cursor range. That is useful for contiguous selection, but it makes selection an extension of cursor/highlight state. That shape does not naturally support discontiguous row selection without adding a second selection mechanism later.

Proposed shape

PR #6585 keeps selection separate from cursor state:

  • selected rows are stored as row keys;
  • a selection anchor supports range selection;
  • selection changes emit a dedicated event;
  • selected rows have their own component class;
  • cursor/highlight behavior is preserved.

The goal is to support both contiguous and discontiguous row selection while keeping the existing DataTable cursor semantics intact.

I am opening this issue mainly to make the feature request easier to track independently from the implementation PRs.

-- Matteo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions