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

When reordering and skipping a column, the column gets duplicated #497

Closed
gerhardboer opened this issue Feb 8, 2017 · 3 comments
Closed

Comments

@gerhardboer
Copy link
Contributor

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior
If you reorder the first column to the third column, the column get duplicated.
It happens sometimes if you have 4 columns, and reorder the 2nd and 4th.
Going from right to left does not seem to cause any issues.

Expected behavior
Columns do not get duplicated

Reproduction of the problem
Reorder the Name and Company column on https://swimlane.github.io/ngx-datatable/

First analysis
I've found out that onColumnReorder gets called twice and I've put a console.trace() in datatable.component.ts:919 to see where the second call comes from.
It originates in DraggableDirective where the dragEnd gets emitted, and it looks like the mouseup event is handled twice.
However, any console logs in DraggableDirective.onMousup only print once. Also any breakpoints are skipped the second time, but the browser does follow breakpoints the first time.

stacktrace
The framework calls were removed for sanity. This stacktrace is printed twice in onColumnReorder.

/src/components/datatable.component.ts.DatatableComponent.onColumnReorder src/components/header/header.component.ts.DataTableHeaderComponent.onColumnReordered src/directives/orderable.directive.ts.OrderableDirective.onDragEnd src/directives/draggable.directive.ts.DraggableDirective.onMouseup Wrapper_DraggableDirective.handleEvent // the call to onMouseup View_DataTableHeaderComponent2.handleEvent_0

What is the motivation / use case for changing the behavior?
Does not seem like desired behavior.

Please tell us about your environment:

  • Table version: 6.0.2
  • Angular version: 2.4.5
  • Browser: [ Chrome XX | Firefox XX ]
  • Language: [all | TypeScript X.X ]
@gerhardboer
Copy link
Contributor Author

I've created a branch in my fork with a protractor test to validate the issue:
https://github.com/gerhardboer/nxg-datatable/tree/e2e-bug-497

@emonney
Copy link

emonney commented Feb 15, 2017

Same issue. I'm using 6.1.2 (latest version)
I noticed this from Version 5 when I first got on board. Library keeps getting better with each day, hope this also gets tackled soon.

@gerhardboer gerhardboer mentioned this issue Feb 25, 2017
8 tasks
@Angel1109
Copy link

Hey guys, we are using the ngx-datable for our project and we have requirement for the reorder functionality to work.Please let us know by when you plan this fix to be released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants