Data Grid Cell Caching
Overview
The cache feature allows a formula's result to be stored, accelerating the loading time of a new spreadsheet.
Documentation
Methods
The following methods can be used to get or set comments in one or multiple data grid cells.
Method | Description |
---|---|
getCache | Get the cache for a cell. worksheetInstance.getCache(cellName: String) |
setCache | Set the cache for one or more cells. @param {string|object} cellName - Identification of a cell or an object with multiple definitions @param {string?} value worksheetInstance.setCache(cellName: String | object, value?: String) |
Initial Settings
The following properties are available through the initialization of the online spreadsheet.
Property | Description |
---|---|
cache: object | Object with the initial cache values. Example: { A1: 'test', B1: 'another test' } |
Examples
Loading formula values from cache
To optimize formula value caching in Jspreadsheet, initialize the spreadsheet with the configuration set to use cached data for formulas. This approach speeds up the loading of pre-calculated values, improving performance and user experience, particularly in data-heavy scenarios.
// Create the spreadsheet
let worksheets = jspreadsheet(document.getElementById('spreadsheet'), {
worksheets: [{
minDimensions: [10,10],
data: [
[10,'=SUM(A1)*10'],
],
cache: { B1: 100 },
}],
});