I have a table with data that comes from the backend these have range validations if it is not respected it changes the background to a color. The problem I have is that it adds a button to undo changes and what I do is.
I edit cells with invalid data and then undo the changes, everything restores fine except for the validations that the background remains red.
Try to solve it by changing with a FOR loop all the edited cells to a td.style.backgroundColor = ‘white’ and that works for 1 second then after that it returns to the red color as if it made a callback to the validation that is in the AfterChange.
Code when I click on the undo changes button.
let hotInstance = this._hotRegisterer.getInstance (this.instance);
this.array_notas.forEach (cell => {
let td = hotInstance.getCell (cell.row, cell.col);
td.style.backgroundColor = ‘#FFFFFF’
//if(!cell.save) hotInstance.setDataAtCell (cell.row, cell.col, cell.firstVal);
})
hotInstance.loadData (this.original_cell_data);
if (hotInstance) {
hotInstance.updateSettings ({
columns: this.columns,
cell: this.cellCustom,
});
this.original_cell_data = hotInstance.getData ();
}
});
the original_cell_data variable saves the table info before being edited and I use the loadData to restore the changes but what I can’t restore is the backgrounds in cells activated by a renderer configured in the AfterChange