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

    Function useColumnState

    • Column order, visibility, width and pinning, merged over the definitions' defaults.

      Persisted state is merged key by key rather than replacing the defaults wholesale — so a layout saved before a new column was added does not hide that column, and does not discard defaults it says nothing about.

      Type Parameters

      • T

        The row type.

      • C

        The context type.

      Parameters

      • columns: ColumnDef<T, C>[]
      • persisted:
            | {
                hidden: string[];
                order: string[];
                pinned: Record<string, Pinned>;
                widths: Record<string, number>;
            }
            | undefined
        • {
              hidden: string[];
              order: string[];
              pinned: Record<string, Pinned>;
              widths: Record<string, number>;
          }
          • hidden: string[]

            Ids of columns the user hid.

          • order: string[]

            Column ids in display order.

          • pinned: Record<string, Pinned>

            User-pinned columns, by column id.

          • widths: Record<string, number>

            User-resized widths, by column id.

        • undefined
      • onChange: (state: ColumnStateValue) => void
      • availableWidth: number

      Returns UseColumnStateResult<T, C>

      The resolved columns, their layout, and the mutators.