isUndoAvailable() is false

Tags: #<Tag:0x00007f8b28c4aaf8>

Hello there.
I started taking part in a project which uses Hands on table and there is a problem I cannot fix

The project is using custom editors and renderers and changing data is not causing HOT to offer me UNDO. isUndoAvailable() is false. Do you have any specific instructions for me - how to make changes UNDOABLE?
Can I see an example of proper editor’s saveValue

Hi @alexander1

can you share the editor and renderer part of your code in the JSFiddle to let me reproduce the issue?

var sheetlyEditor = Handsontable.editors.TextEditor.prototype.extend();

sheetlyEditor.prototype.beginEditing = function (arg, event) {
    var val = this.originalValue.value;
    self.inEditor = true;
    if (event) {
        if (event.key && event.key !== 'F2' && event.key !== 'Enter' && event.key !== 'Dead') {
            val = '';
        }
    }
    Handsontable.editors.TextEditor.prototype.beginEditing.apply(this, [val]);
};

sheetlyEditor.prototype.saveValue = function (val) {
    var _self = this;

    if (_self.originalValue.value === val[0][0]) {
        return;
    }

    var row = this.row;
    var col = this.col;
    var cellData = _self.originalValue;
    self.inEditor = false;
    _self.instance.setDataAtCell(row, col, response);
    cellData.value = val[0][0];
    _self.cellProperties.readOnly = true;
    _self.instance.render();

    $.ajax({
        method: "PUT",
        url: baseUrl + "update2",
        data: cellData,
        success: function (response) {
            self.data.rows[row] = response;
            // _self.instance.setDataAtCell(row, col, response);
            _self.instance.setCellMeta(row, col, 'readOnly', false);
            _self.instance.render();
        },
    });
};

Found solution. Should use setDataAtCell and undo is then available

Great. I am happy that you’ve found a fix.

I think that we can close the topic.