jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.72k stars 824 forks source link

How do I handling events with the Undo/Redo function? (ver1.5.x) #160

Closed adm90 closed 6 years ago

adm90 commented 6 years ago

ver1.5.0~ than onChange does not work with Undo/Redo. Is there a way to catch event handling with the Undo/Redo function?

In this example, the Undo/Redo function is handled in the onchange event. (jquery.jexcel.js ver1.3.3) https://jsfiddle.net/paulhodel/0dyms2b9/

  1. A1 Cell value changed [2006 -> 1234], Enter
  2. Undo (ctrl+z) -> Working onchange event handling
  3. Redo (ctrl+y) -> Working onchange event handling

But, ver1.5.0~ than onchange does not work with Undo/Redo. (I replaced javascript file in jsfiddle and tried it) (jquery.jexcel.js ver1.5.2) (https://cdnjs.cloudflare.com/ajax/libs/jexcel/1.5.2/js/jquery.jexcel.js)

Event handler can not be caught in onchange function. Because undo function variable ignoreEvents is always true.

Is there a way to catch event handling with the Undo/Redo function? (or other events?)

pphod commented 6 years ago

You can change this $.fn.jexcel.ignoreEvents = true;

To $.fn.jexcel.ignoreEvents = false; on line 4011

Please, update for the most recent version from the master repo.

adm90 commented 6 years ago

Thank you for your reply.

It did not work on change of line 4011.(from master repo) I changed the line 1995, problem was solved.

$.fn.jexcel.ignoreEvents = false; on line 1995 (function loadCells)

Thank you very much.