PivotCache
Runtime representation of a pivot cache: wraps the JSF PivotCache definition and exposes
resolved records with shared-item indices replaced by actual values.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PivotCache(jsf): PivotCache;Parameters
Section titled “Parameters”PivotCache
Returns
Section titled “Returns”PivotCache
Properties
Section titled “Properties”readonly jsf: PivotCache;resolvedRecords
Section titled “resolvedRecords”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.
Accessors
Section titled “Accessors”compiledCalcFields
Section titled “compiledCalcFields”Get Signature
Section titled “Get Signature”get compiledCalcFields(): ReadonlyMap<number, CompiledCalcField>;Returns
Section titled “Returns”ReadonlyMap<number, CompiledCalcField>
fieldNames
Section titled “fieldNames”Get Signature
Section titled “Get Signature”get fieldNames(): string[];Returns
Section titled “Returns”string[]
sourceRef
Section titled “sourceRef”Get Signature
Section titled “Get Signature”get sourceRef(): string | undefined;Returns
Section titled “Returns”string | undefined
sourceSheet
Section titled “sourceSheet”Get Signature
Section titled “Get Signature”get sourceSheet(): string | undefined;Returns
Section titled “Returns”string | undefined
Methods
Section titled “Methods”adjustSourceRange()
Section titled “adjustSourceRange()”adjustSourceRange( sheetName, dimension, index, count): void;Adjust the source data range after rows or columns are inserted or deleted on a sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
the sheet where the structural edit happened
dimension
Section titled “dimension”Dimension
‘row’ or ‘col’
number
0-based index where insertion/deletion starts
number
positive for insertion, negative for deletion
Returns
Section titled “Returns”void
handleSourceSheetRemoved()
Section titled “handleSourceSheetRemoved()”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.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
Returns
Section titled “Returns”void
refreshFromWorksheet()
Section titled “refreshFromWorksheet()”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.
Parameters
Section titled “Parameters”getCell
Section titled “getCell”(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.
resolvedSource?
Section titled “resolvedSource?”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
options?
Section titled “options?”recomputeCalcFields?
Section titled “recomputeCalcFields?”boolean
Returns
Section titled “Returns”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()
Section titled “renameSourceSheet()”renameSourceSheet(oldName, newName): void;Update the source sheet name after a sheet rename.
Parameters
Section titled “Parameters”oldName
Section titled “oldName”string
newName
Section titled “newName”string
Returns
Section titled “Returns”void