primeng icon indicating copy to clipboard operation
primeng copied to clipboard

DataTable Column Reordering Does Not Match Indicator

Open Freddy090909 opened this issue 9 years ago • 1 comments

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

[ X ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports) http://plnkr.co/edit/fDLCtnECy85PaxkizZUw?p=preview

Current behavior Column reordering has an issue when dragging columns. When you attempt to drag+drop a column, where the column lands is determined by which side of the "column seperator" you dropped on.

Expected behavior I expect that the column should be dropped between the columns indicated by the drag+drop arrow.

Minimal reproduction of the problem with instructions My plunkr above should be enough to reproduce this (note this problem also exists on the demo page at https://www.primefaces.org/primeng/#/datatable/colreorder).

Steps (left -> right):

  1. Click and drag "Vin" so that the arrow marks it to be dropped between "Year" and "Brand".
  2. Drop "Vin" with your mouse hovering to the >right< of the drag+drop arrow (over "Brand").
  3. Your columns should now show "Year", "Brand", "Vin", "Color". Expectation is "Year", "Vin", "Brand", "Color".

Steps (right -> left):

  1. Click and drag "Color" so that the arrow marks it to be dropped between "Vin" and "Year".
  2. Drop "Color" with your mouse hovering to the >left< of the drag+drop arrow (over "Vin").
  3. Your columns should now show "Color", "Vin", "Year", "Brand". Expectation is "Vin", "Color", "Year", "Brand".

What is the motivation / use case for changing the behavior? I believe this is a bug.

Please tell us about your environment: OS: Win10 IDE: VS 2017

  • Angular version: 4.2.2

  • PrimeNG version: 4.1.0

  • Browser: Chrome Version 59.0.3071.115 / IE 11

  • Language: TypeScript 2.3.4

  • Node (for AoT issues): node --version = v6.11.1

Freddy090909 avatar Jul 14 '17 15:07 Freddy090909

this should not be closed, the bug still exists in 4.2

http://plnkr.co/edit/QGx803B8GVa9VWGgaNaQ?p=preview

It seems that the dropIndex is wrong: when you show the indicator (while dragging) you do some consideration about the destination column center (see onColumnDragover(event) ) while when you do the actual reorder, you don't do the same consideration (see onColumnDrop(event)).

dbmbm avatar Oct 02 '17 08:10 dbmbm