Skip to content

Commit

Permalink
fixed issue with position calculation in history module row move redoer
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed Jul 23, 2023
1 parent b042f21 commit 387b6db
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
17 changes: 9 additions & 8 deletions dist/js/tabulator_esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -12634,8 +12634,10 @@ var defaultUndoers = {
},

rowMove: function(action){
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom-1], action.data.after);

var after = (action.data.posFrom - action.data.posTo) > 0;

this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posFrom), after);

this.table.rowManager.regenerateRowPositions();
this.table.rowManager.reRenderInPosition();
},
Expand All @@ -12662,8 +12664,10 @@ var defaultRedoers = {
},

rowMove: function(action){
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after);
this.table.rowManager.redraw();
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posTo), action.data.after);

this.table.rowManager.regenerateRowPositions();
this.table.rowManager.reRenderInPosition();
},
};

Expand Down Expand Up @@ -12696,10 +12700,7 @@ class History extends Module{
}

rowMoved(from, to, after){
var fromPos = from.getPosition(),
toPos = to.getPosition();

this.action("rowMove", from, {posFrom:fromPos, posTo:toPos, to:to, after:(fromPos - toPos) > 0});
this.action("rowMove", from, {posFrom:from.getPosition(), posTo:to.getPosition(), to:to, after:after});
}

rowAdded(row, data, pos, index){
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.js.map

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions src/js/modules/History/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ class History extends Module{
}

rowMoved(from, to, after){
var fromPos = from.getPosition(),
toPos = to.getPosition();

this.action("rowMove", from, {posFrom:fromPos, posTo:toPos, to:to, after:(fromPos - toPos) > 0});
this.action("rowMove", from, {posFrom:from.getPosition(), posTo:to.getPosition(), to:to, after:after});
}

rowAdded(row, data, pos, index){
Expand Down
6 changes: 4 additions & 2 deletions src/js/modules/History/defaults/redoers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export default {
},

rowMove: function(action){
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after);
this.table.rowManager.redraw();
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posTo), action.data.after);

this.table.rowManager.regenerateRowPositions();
this.table.rowManager.reRenderInPosition();
},
};
6 changes: 4 additions & 2 deletions src/js/modules/History/defaults/undoers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export default {
},

rowMove: function(action){
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom-1], action.data.after);

var after = (action.data.posFrom - action.data.posTo) > 0;

this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posFrom), after);

this.table.rowManager.regenerateRowPositions();
this.table.rowManager.reRenderInPosition();
},
Expand Down

0 comments on commit 387b6db

Please sign in to comment.