Skip to content

[Feature]: In DataGrid, add support for making certain rows not selectable when we have selectionMode="multiselect" #35425

@yaoyao-ict

Description

@yaoyao-ict

Area

React Components (@fluentui/react-components)

Describe the feature that you would like added

If we want to enable multi select feature and need to make certain rows un-selectable, we have no native api to do that.

We can hide the checkbox and customize the onSelectionChange implementation to exclude the rows that cannot be selected, but the checkbox in header will always show that 3rd indeterminate state when all the selectable rows have been selected, because DataGrid internally doesn't know those rows are un-selectable.

To fix this issue, can we add a new prop isRowSelectable in DataGrid:

            selectionMode="multiselect"
            isRowSelectable={(item) => {
              // Only root level rows are selectable (items without isChild flag)
              return !(item as any).isChild;
            }}

So that header checkbox can show correct state when all selectable rows have been selected.

Additional context

No response

Have you discussed this feature with our team

No response

Validations

  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

Priority

High

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions