@cfxlabsinc/b2b-services
    Preparing search index...

    Multi-row selection for a list table, per page: it clears whenever the server hands down a new set of rows, so a stale key never acts on a row the operator can no longer see. toggle takes the row index so Shift-click can extend a range from the last-toggled anchor. Rows sharing a getGroup value are ticked and unticked together.

    type MultiRowSelection<T> = {
        allSelected: boolean;
        clear: () => void;
        count: number;
        deselect: (ids: string[]) => void;
        isSelected: (id: string) => boolean;
        selectedIds: ReadonlySet<string>;
        selectedItems: T[];
        someSelected: boolean;
        toggle: (id: string, index: number, range?: boolean) => void;
        toggleAll: () => void;
    }

    Type Parameters

    • T
    Index
    allSelected: boolean

    Every row on the page is selected (header checkbox = checked).

    clear: () => void
    count: number
    deselect: (ids: string[]) => void

    Drop the given ids from the selection, leaving the rest ticked.

    isSelected: (id: string) => boolean
    selectedIds: ReadonlySet<string>
    selectedItems: T[]
    someSelected: boolean

    Some but not all rows selected (header checkbox = indeterminate).

    toggle: (id: string, index: number, range?: boolean) => void

    Toggle one row; pass range: true (Shift) to extend from the last anchor.

    toggleAll: () => void

    Select every row on the page, or clear if all are already selected.