Skip to content

PivotCache

Runtime representation of a pivot cache: wraps the JSF PivotCache definition and exposes resolved records with shared-item indices replaced by actual values.

new PivotCache(jsf): PivotCache;

PivotCache

PivotCache

readonly jsf: PivotCache;

readonly resolvedRecords: readonly readonly CellValue[][];

Resolved records: one CellValue per cache field per record. Declared readonly for external consumers; internal mutation in refreshFromWorksheet uses a narrow cast.

get compiledCalcFields(): ReadonlyMap<number, CompiledCalcField>;

ReadonlyMap<number, CompiledCalcField>


get fieldNames(): string[];

string[]


get sourceRef(): string | undefined;

string | undefined


get sourceSheet(): string | undefined;

string | undefined

adjustSourceRange(
sheetName,
dimension,
index,
count): void;

Adjust the source data range after rows or columns are inserted or deleted on a sheet.

string

the sheet where the structural edit happened

Dimension

‘row’ or ‘col’

number

0-based index where insertion/deletion starts

number

positive for insertion, negative for deletion

void


handleSourceSheetRemoved(sheetName): void;

Clear the source ref if the cache sources from the given sheet. Prevents a subsequent refreshFromWorksheet from overwriting the last-refreshed records with nulls read from the missing sheet. Matches Excel’s behaviour: cached data is retained after source sheet removal.

string

void


refreshFromWorksheet(
getCell,
resolvedSource?,
options?): boolean;

Refresh the cache records from the worksheet source range.

Reads cell values from the workbook, rebuilding records from the data rows. Calculated fields (those with a formula) are not refreshed; their values are preserved from existing records, and rows beyond oldRecords.length leave their calculated cells null. Grouped (fieldGroup) fields are re-derived from their (refreshed) base field after the records are rebuilt.

(sheet, row, col) => object

function returning the cell’s resolved value and optional number format string in a single call. The format is used to detect date-formatted cells so their values are encoded as {t:'d', v: isoString} in JSF; pass format: undefined (or omit it) to skip date detection.

optional concrete { sheet, ref } to read from, used when the source is a defined name or Excel Table (worksheetSource.type === 'name') that the caller has already resolved to a literal range. When omitted, the literal worksheetSource.ref / .sheet is used (the type:'range' case).

string

string

boolean

boolean

true when records were rebuilt from the source, false when the cache isn’t a worksheet source, the source ref is unparseable, OR the freshly-read records (and their date-format encoding) match the existing records cell-for-cell. The third case is a true no-op: source unchanged means callers can skip any layout / materialize / recalculate work.


renameSourceSheet(oldName, newName): void;

Update the source sheet name after a sheet rename.

string

string

void