@helix-x/datagrid-ui - v0.2.0
    Preparing search index...

    Function useSelectionModel

    • Multi-row selection with shift-range support.

      Selection survives paging: ids stay selected even when their rows are not loaded, which is why getSelectedRows returns only the loaded subset while selectedIds holds everything.

      Type Parameters

      • T

        The row type.

      Parameters

      • rows: T[]

        The currently loaded page.

      • getRowId: (row: T) => RowId

        Stable identity for a row.

      • OptionalonSelectionChanged: (ids: RowId[]) => void

        Called with every selected id after each change.

      • OptionalisRowSelectable: (row: T) => boolean

        Rows it returns false for cannot be toggled, and are skipped by shift-ranges and by select-all. Every row when omitted.

      Returns UseSelectionModelResult<T>

      The selection state and its mutators.