I’d like to show the differences in a row before and after a number of cells are edited. As an example if you have a row numbered ‘7’ of 5 cells, all cells have values a,b,c,d,e,f and you drag-select a,b,c and press delete I want to be able to show a diff:
Row: 7
Change made: a,b,c,d,e,f
In afterChange or even beforeChange I can’t get the value of the row before the change was made. The only solution I have at the moment seems to be keeping my own copy of the entire data model for HOT, which sounds inefficient. Does anyone have a better idea?
I have a debounce setup at ~500ms so that I can capture multiple cell changes as just one ‘row change’. I could really painfully try and back off all the change deltas from the new row value, but that also sounds painful.
Whilst I was waiting i’ve accomplished this with a debounce and a state variable that accumulates oldValues for a given ‘changeset’ and then plays them back over the final row value (fetched in the debounce) to derive original row value. Not ideal, but works. Please do tell me if there’s a much nicer way I could have used.
But I want the old value for the row. If I try and fetch the row value from my hotTable.getDataAtRow(rowNumber) in beforeChange I think it was already updated. If that sounds wrong I can go back and look again. It could be that instead of ‘stepping backwards’ in afterChange I could store the initial row value in beforeChange to send off later (after a debounce indicates to me this is the only cell on that row being altered).
I’m building a ‘track changes’ feature, so below the main HotTable people can see a list of changes to rows e.g. 'row 5 at 11:10AM, John added values ‘blah’, ‘bleh’, ‘foo’ and removed ‘ragno’ (which i’m displaying with a strikethrough). LMK if i’m missing a simple plugin for that