Luckysheet
Luckysheet copied to clipboard
[Feature request] Can Luckysheet generate an event in case of actual cell modification?
Hi, it is just a question. How to detect that anything in the sheet has actually been modified? I need it for enabling the "Save" button in my app.
I've also been trying to detect cell updates. It'd be great to integrate Luchysheet into a webapp with state management. Did you find a way to do it @d01010101?
Only this, somewhat crude: after a mouse/keyboard interaction with the sheet, test if getJson() changed.
I found an easier way to detect cell updates: using the hooks implemented in luckysheets. You can pass your code to be run in every cell update to the configuration object:
useEffect(() => {
const sheet = window.luckysheet
sheet.create({
container: "luckysheet",
title: "workbook",
lang: 'en',
data: data,
hook: {
updated: function (operate) {
const r = operate.range[0].row[0]
const c = operate.range[0].column[0]
if (r === 0 && c === 0) {
setState({...state, x: operate.curdata[r][c].v})
}
}
}
})
}, [])
The new version https://github.com/ruilisi/fortune-sheet seems to have callbacks.