Skip to content

Commit

Permalink
Changed structure
Browse files Browse the repository at this point in the history
  • Loading branch information
hsemarap committed Oct 25, 2015
1 parent c2b3a84 commit b759d08
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/sensei-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@

// stores the original content and records the cell row and column
var edit = {
"type":"cell",
"previousState": plugin.getCellData($td),
"currentState": val,
"row": plugin.getRowData(plugin.getCellRow($td))["id"],
Expand Down Expand Up @@ -897,18 +898,22 @@
if (e.ctrlKey || e.metaKey) {
var edit = plugin.undo();

if (('row' in edit) && ('column' in edit)) {
if (edit.type === 'cell') {
if (('row' in edit) && ('column' in edit)) {

var row = plugin.getRowByIndex(edit.row - 1);
var element = plugin.getCellFromRowByIndex(row, edit.column);
var row = plugin.getRowByIndex(edit.row - 1);
var element = plugin.getCellFromRowByIndex(row, edit.column);

// set value from editor to the active cell
element.html($("<div>").text(edit.previousState));
// set value from editor to the active cell
element.html($("<div>").text(edit.previousState));

// trigger editor:save event
var data = {};
data[element.data("column")] = edit.previousState;
plugin.events.trigger("editor:save", data, element);
// trigger editor:save event
var data = {};
data[element.data("column")] = edit.previousState;
plugin.events.trigger("editor:save", data, element);

}
} else if (edit.type === 'row') {

}
}
Expand Down

0 comments on commit b759d08

Please sign in to comment.