SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface ISheetHeader

    Provides a programmatic interface for interacting with and modifying entire rows or columns in a spreadsheet, allowing for actions such as inserting, deleting, resizing, and applying formatting changes.

    interface ISheetHeader {
        isISheetHeader: true;
        addListeners(
            listeners: ISheetHeader.IListeners,
            options?: IListener.Options,
        ): Remove;
        at(index: number): ICellHeader;
        beginCommit(options?: string | ITransaction.OperationOptions): ITransaction;
        close(): void;
        doBatch<R = any>(
            callback: (commit: ICommit) => R | Promise<R>,
            options?: string | ITransaction.OperationOptions,
        ): R | Promise<R>;
        getAxis(): Axis;
        getDefaultSizeNative(): number;
        getEntireRange(
            options?: ICellHeaderRange.GetRangeOptions,
        ): ICellHeaderRange;
        getFilteredRanges(
            coords?: Readonly<RunCoords>,
        ): readonly ICellHeaderRange[];
        getId(): string;
        getMaxSize(): number;
        getMetrics(): IMetrics;
        getMinSize(): number;
        getRange(
            address: ICellHeaderRange.Address,
            options?: ICellHeaderRange.GetRangeOptions,
        ): ICellHeaderRange;
        getRanges(
            address: ICellHeaderRanges.Address,
            options?: ICellHeaderRange.GetRangeOptions,
        ): ICellHeaderRanges;
        getSelectedRange(
            options?: ICellHeaderRange.GetRangeOptions,
        ): ICellHeaderRange;
        getSelectedRanges(
            options?: ICellHeaderRange.GetRangeOptions,
        ): ICellHeaderRanges;
        getSelectedRuns(): readonly ITypes.RunCoordValue<boolean>[];
        getSheet(): ISheet;
        getTextAt(index: number): string;
        getUsedRange(options?: ICellHeaderRange.GetRangeOptions): ICellHeaderRange;
        getVersionId(): number;
        isClosed(): boolean;
        isProtected(): boolean;
        isSelected(index: number): boolean;
        isSelectedAll(index: number): boolean;
        toJSON(): ISheetHeader.JSON | null;
        updateHeaderPairs(
            pairs: AddressUpdatePair[],
            options?: UpdateHeadersOptions,
        ): RunCoords[] | null;
    }

    Hierarchy (View Summary)

    Index
    isISheetHeader: true

    For runtime type checking.

    • Returns the header at a given offset. Will only return null for invalid header offset. To get a list of headers use getRange.

      Parameters

      • index: number

        0-based absolute index.

      Returns ICellHeader

    • Batches all 'transactional' changes until they have all be committed or rolled back.

      Parameters

      • Optionaloptions: string | ITransaction.OperationOptions

        Description of the operation or additional options. Used for tracking undo/redo and history. Default Value User Operation.

      Returns ITransaction

      Any changes that are made to this object will be reflected in the local record but not committed to the transactional store until the batch is popped.

      Useful for operations that are longer running but generally not recommended as it keeps a transaction open. doBatch is the preferred option.

    • Close the record and cleans resources. Can't be undone.

      Returns void

    • Provides a mechanism to perform a set of operations in a batch.

      Type Parameters

      • R = any

      Parameters

      • callback: (commit: ICommit) => R | Promise<R>

        A callback that performs multiple operations all within the same transaction.

      • Optionaloptions: string | ITransaction.OperationOptions

        Description of the operation or additional options. Used for tracking undo/redo and history. Default Value User Operation.

      Returns R | Promise<R>

      Writes are tracked automatically: a batch that performs no state updates (a read-only batch) is elided — the commit id is unchanged, no events fire, and nothing is added to the undo stack or commit log.

    • The axis the headers manage.

      Returns Axis

    • The default header size in native units.

      Returns number

    • Returns the ranges of headers a filter holds a condition over: on the row axis, the data rows of the AutoTable and of every table whose ITable.getActiveFilters is not empty; on the column axis none, as nothing filters columns.

      Parameters

      • Optionalcoords: Readonly<RunCoords>

        Only the ranges that meet this run, when given (a viewport).

      Returns readonly ICellHeaderRange[]

      A sheet with any is "filtered", as Excel has it: SUBTOTAL 1-11 leave out every hidden row of a filtered sheet, hand-hidden ones included, and count them all on an unfiltered one; the visible headers of these ranges are the ones drawn as filtered. A condition counts whether or not it hides a row.

      A row hidden by hand and a row hidden by a filter are the same hidden row; nothing records which, and clearing a filter shows both (ITable.deleteFilters).

    • A unique identifier for the record. This will never change.

      Returns string

      This enables the record to be identified across transactions and users in a collaborative environment. The id is store-issued (IStore.create); the store keys all state by it.

    • The maximum size of the header in native units.

      Returns number

    • Returns the header's measurements: pixel sizes, offsets and hidden headers, as they are now.

      Returns IMetrics

      The returned object does not change. The header returns the same object until a measurement changes, then a new one, announced by ISheetHeader.Events.onMetricsChange. Hold on to it to keep measuring against one consistent layout; compare identities to tell whether anything moved. Calling this repeatedly is cheap.

    • The minimum size of the header in native units.

      Returns number

    • Returns the sheet model used for the header.

      Returns ISheet

    • Returns a displayable title for the given index.

      Parameters

      • index: number

        0-based absolute index.

      Returns string

    • Every committed update gives the record a new, strictly increasing version id.

      Returns number

      Used with getId to uniquely identify a version of the record.

      The id is an identity, not a per-record count: ids are drawn from a single store-wide sequence bumped once per commit, so all records written in the same commit share an id and a given record's ids increase but are not sequential.

      Records are immutable so a restore/revert doesn't change them — it repoints, and the version id reported is the one for the snapshot the store is currently at. Version ids are never reused: a write after an undo receives an id higher than any previously issued, so a stale reader can always detect the change.

    • Returns true if no more operations are allowed.

      Returns boolean

    • Returns a flag indicating if the headers are protected by the sheet.

      Returns boolean

    • Returns true if header has a selection at the given index.

      Parameters

      • index: number

      Returns boolean

    • Returns true if header has a max selection at the given index.

      Parameters

      • index: number

      Returns boolean

    • Save the header state to a JSON object.

      Returns ISheetHeader.JSON | null

      Returns null if there is nothing to persist.

    • Sets the headers. This supports setting values as a batch.

      Parameters

      Returns RunCoords[] | null

      When setting headers the cells references by this sheet will not update. To ensure they are updated on the sheet call updateHeaderPairs with the range from the header.