hi, how is possible to persist a changed ?
I added this event hook to change a cell when other cells has changed but when I configure the next cell the previous alert is delete, example:
[ 1][2][ ][ ]
[ 1][2][ ][ ]
[ 1][2][ ][ ]
[ 1][2][ ][ ]
[ 2][2][ ][X]
[ 1][2][ ][ ]
[ 1][2][ ][ ]
[ 2][2][ ][ ]
[ 2][2][ ][X ]
I want that the first change don’t disappear when i do the second change
tabla.addHook(‘afterChange’, function(changes, source) {
if (source === ‘loadData’ || source === ‘internal’ || changes.length > 1) {
return;
}else{
var row = changes[0][0];
var prop = changes[0][1];
var valueNew = changes[0][3];
var valueOld = changes[0][2];
if (valueNew!==valueOld) {
record[contador] = " fila: "+ (row+1) + " "+prop+" antes: "+valueOld+" despues: "+valueNew;
console.log(record[contador]);
contador++;
alerta(changes);
}
}
});
function alerta(a){
tabla.updateSettings({
cells: function (row,col){
const cellPrp = {};
if (col === 6 ) {
cellPrp.renderer = myBtnsTrash;
cellPrp.readOnly = false;
}
if (col === 7 && row === tabla.getSelectedLast()[0]){
//a[0][0]
cellPrp.renderer = myBtnsAlert;
cellPrp.readOnly = false;
}
return cellPrp;
}
})
function myBtnsAlert(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
td.style.backgroundColor = ‘red’;
}
Best regards.