cellx
cellx copied to clipboard
Guidance requested
Thanks for the awesome library. I'm looking for some architectural guidance
I'm looking at using cellx as the basis for a calculation engine, much like excel.
I'd like to have a bunch of cellx variables that represent cells on a spreadsheet, i.e. columns and rows
Some of these have formulas that get computed based on changes in other cells.
For example, say I have A1 = cellx(), A2 =cellx(), etc, etc and I want A3 to be the sum of A1+A2
When A1 or A2 changes, I'd like A3 to be updated automatically.
I'd like to have a matrix of rows and columns, like excel that are reactive to changes in the cells.
Any help would be appreciated ... thanks.
Like this?
import {cellx, Cell} from "cellx"
let num = cellx(1);
let plusOne = cellx(() => num() + 1);
plusOne.onChange((evt) => {
console.log(JSON.stringify(evt.data)) //prints {"prevValue":2,"value":3}
})
num(2)