Skip to content
Apiary

PivotField

A handle on one pivot field, addressed by its index into the definition’s fields. The table hands back the same object on every lookup. A cache refresh that reorders the source columns moves the handle with its column; one that drops the column marks it removed (isRemoved): it then reports the name it had, no placement and no items, and refuses mutation. Mutators must run inside PivotManager.update.

readonly table: PivotTable;
get axis(): PivotFieldAxis | null;

PivotFieldAxis | null


get filters(): readonly PivotFieldFilter[];

Immutable descriptors, rebuilt on every read. Includes the manual filter synthesized from the field’s hidden items.

the table is not registered with a pivot manager

readonly PivotFieldFilter[]


get isRemoved(): boolean;

boolean


get items(): readonly PivotItem[];

the table is not registered with a pivot manager

readonly PivotItem[]


get name(): string;

string


get position(): number;

number


get showAll(): boolean;

boolean


get sourceName(): string;

string

clearFilters(kind?): void;

Removes this field’s filters of kind, or all of them when kind is omitted. kind matches exactly: clearing 'value' leaves a top/bottom filter in place, and vice versa.

PivotFieldFilterKind

void

the table is not registered, or is edited outside PivotManager.update


setAxis(axis): void;

PivotFieldAxis | null

void


setFilter(filter): void;

Replaces the filter of the same kind this field already carried. A value filter and a top/bottom filter share one slot in Excel, so setting either one replaces the other.

PivotSettableFilter

void

the table is not registered, is edited outside PivotManager.update, or the filter names a measure or item this field cannot address, removed handles included

the condition’s operands are missing or not finite


setName(name): void;

Rejects a caption equal, under excelNameKey, to one that another field of this table stores, because Excel repairs such a workbook by dropping the pivot table. A caption equal to another field’s inherited cache name is allowed.

string

void

another field of this table stores an equal caption


setShowAll(showAll): void;

boolean

void


setSort(order, by?): void;

Sorts by by’s values when a measure is given, by the field’s own labels otherwise. A value sort addresses its measure by position, so later measure removals renumber it.

"ascending" | "descending"

PivotMeasure

void

the table is not registered, is edited outside PivotManager.update, or by belongs to another pivot table or was removed