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;

Moves the field to the end of axis, or removes it from the pivot table with null.

Moving the field onto the page area from anywhere else removes its label, value, top/bottom and date filters. Its hidden items stay hidden and keep filtering: as in Excel, the field then allows selecting multiple items, and still does after it moves off the page area.

PivotFieldAxis | null

The axis to move the field to, or null to remove it from the pivot table

void

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


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.

On a page field, or a field on no axis, a label, value or top/bottom filter is stored but does not filter the table, as in Excel.

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