Tabulator: cancelEdit throws Uncaught ReferenceError: force is not defined at c.cancelEdit (tabulator.min.js:3)

Created on 1 Oct 2018  路  3Comments  路  Source: olifolkerd/tabulator

When calling cancelEdit on a cell with

cell.cancelEdit();

JS throws:

Uncaught ReferenceError: force is not defined at c.cancelEdit (tabulator.min.js:3)

and the edit is not cancelled.

Tested with Tabulator 3.5, but I've looked at the code of 4.0 and it is identical, so I assume the problem is the same.

The problematic code is here:

    CellComponent.prototype.cancelEdit = function () {

      this.cell.cancelEdit(force);
    };

the force argument of cancelEdit is undefined.
I imagine this is a copy/paste error from the function immediately above:

    CellComponent.prototype.edit = function (force) {

      return this.cell.edit(force);
    };

I've fixed this by removing the force parameter like

      return this.cell.edit();

because in the docs there is no reference to a force parameter and because in other parts of the code all the calls to cancelEdit() are always done without an argument.

In addition to this I like to highlight that I call cancelEdit while in a custom validation function, thus after the edit is successfully cancelled, the red box around the invalid cell remains there while I expect it to disappear.

Bug

All 3 comments

Thanks for getting in touch.

This issue was resolved in the 4.0 release. Please try using 4.0 and see what happens.

It was actually the function calles after your example that had the issue and that has been changed in the 4.0 release.

Cheers

Oli :)

Ahh sorry.

Missread your message there. Thought you were talking about the edit function not the cancel edit function. I will look into that this evening for you.

Cheers

Oli

Hey @mindcreations

Thanks for letting me know about this.

I have pushed a fix to the master branch and will include it in a patch release this evening.

Cheers

Oli :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Honiah picture Honiah  路  3Comments

aballeras01 picture aballeras01  路  3Comments

KES777 picture KES777  路  3Comments

yaxino picture yaxino  路  3Comments

andreivanea picture andreivanea  路  3Comments