How to get original cell value/data after the cell was updated?

Tags: #<Tag:0x00007f8b18e2c340>

Hi!

How can I reset cell data to its original value (inside a custom renderer)? Below is part of the code showing the logic of what I am trying to achieve.

const opt = src.find(data=> parseInt(data.id) === parseInt(value));
if(opt) {
value = opt.label;
}
if(value === null){
value = columnSettings.placeHolder;
}
if(value === undefined){
value = previousValue ; //should reset the cell’s original value
}
Handsontable.renderers.getRenderer(‘dropdown’).apply(
this,
[instance, td, row, col, prop, displayValue !== null ? displayValue : value, cellProperties],
);
}

Thank you.

Hi @pippo.tantan

Currently there are two recommended ways to get the initial value, you can:

  • make a call to the server that holds a copy of table data;
  • parse a stringified data (reopen a deep copy);

We don’t have the examples showing such implementation as it depends heavily on user case.

1 Like