Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in manual column move #963

Merged
merged 1 commit into from
Sep 18, 2013

Conversation

jasoncrawford
Copy link
Contributor

Repro for this bug:

  1. Enable manualColumnMove
  2. Click on the move tab of a column, but don't drag it

Expected: column is not moved

Actual: column can be moved to an arbitrary location

If this is the first time that move-column has been invoked since the
table was initialized, the afterColumnMove callback is actually invoked
with a newIndex parameter of undefined or NaN.

The cause is that endCol is not initialized unless the move tab is
dragged into a different cell. The simple fix is to always initialize
endCol = startCol as soon as we start dragging.

Repro for this bug:

1. Enable manualColumnMove
2. Click on the move tab of a column, but don't drag it

Expected: column is not moved

Actual: column can be moved to an arbitrary location

If this is the first time that move-column has been invoked since the
table was initialized, the afterColumnMove callback is actually invoked
with a newIndex parameter of undefined or NaN.

The cause is that endCol is not initialized unless the move tab is
dragged into a different cell. The simple fix is to always initialize
endCol = startCol as soon as we start dragging.
@bgrohman
Copy link
Contributor

+1 for this fix.

@warpech
Copy link
Member

warpech commented Sep 18, 2013

This pull request will be included in 0.9.18. Thanks!

@warpech warpech merged commit 76be65f into handsontable:master Sep 18, 2013
@jasoncrawford jasoncrawford deleted the column-move-bug branch September 18, 2013 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants