Skip to content

Commit 644b324

Browse files
author
Dana Greenberg
committed
fix(col-movable): prevent hidden columns triggering unnecessary re-order event
1 parent 68681d7 commit 644b324

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/features/move-columns/js/column-movable.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,23 @@
168168
});
169169
},
170170
redrawColumnAtPosition: function (grid, originalPosition, newPosition) {
171+
var columns = grid.columns;
172+
171173
if (originalPosition === newPosition) {
172174
return;
173175
}
174176

175-
var columns = grid.columns;
177+
//check columns in between move-range to make sure they are visible columns
178+
var i0 = Math.min(originalPosition, newPosition);
179+
for (i0; i0 < Math.max(originalPosition, newPosition);i0++) {
180+
if (columns[i0].visible) {
181+
break;
182+
}
183+
}
184+
if (i0 === Math.max(originalPosition, newPosition)) {
185+
//no visible column found, column did not visibly move
186+
return;
187+
}
176188

177189
var originalColumn = columns[originalPosition];
178190
if (originalColumn.colDef.enableColumnMoving) {

0 commit comments

Comments
 (0)