Tabulator: columnResized callback has unexpected column arg depending on direction of resize

Created on 31 Dec 2018  路  4Comments  路  Source: olifolkerd/tabulator

Describe the bug
The argument passed to the columnResized callback is dependent on the direction you approach the resize handle. It should instead always be the column that is being altered.

Fiddle Link:
http://jsfiddle.net/seedante/w05oxste/5/

Tabulator Info

  • Which version of Tabulator are you using?
    4.1.4

To Reproduce

  1. Attempt to resize column A.
  2. Approach the resize handle from the left (column A -> B) and resize, the callback fires with column A.
  3. Approach the resize handle from the right (column B -> A) and resize, the callback fires with column B.

In either case, column A is the one being resized. But the callback is incorrect from the right.

Expected behavior
The column arg to the columnResized method should always be the column whose width/size is altered.

Desktop (please complete the following information):
Windows
Google Chrome
Version 71.0.3578.98 (Official Build) (64-bit)

Bug

Most helpful comment

Hey @c-dante

I have just pushed a fix for this to the master branch and will include it in this weekends patch release.

Cheers

Oli :)

All 4 comments

This is depend on which handle you are dragging: from column A or column B

Compare:
__

__2

The issue is that grabbing the previous handle on B actually resizes A -- B is not the column being resized.

The event being broadcasted isn't "which handle did I grab", but "which column got resized".

As you show in the comparison, only A is changing sizes, but B is broadcasting it's constant size each time you drag from that direction.

See the snippet that is targeting the previous column:
https://github.com/olifolkerd/tabulator/blob/dd43448a7201fc754db25ac34cbeeae949c5088a/src/js/modules/resize_columns.js#L72-L84

And the mouse up callback that does not track this correctly:
https://github.com/olifolkerd/tabulator/blob/dd43448a7201fc754db25ac34cbeeae949c5088a/src/js/modules/resize_columns.js#L130

Gif showing how this change is useful:
peek 2019-01-04 14-39

In that example, the event shows useless columnResized with "b" while "a" is actually the one being resized.

Hey @c-dante

Good spot! that is definitely a bug!

I will resolve that in this weekends patch release.

Cheers

Oli :)

Hey @c-dante

I have just pushed a fix for this to the master branch and will include it in this weekends patch release.

Cheers

Oli :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomheaps picture tomheaps  路  3Comments

andreivanea picture andreivanea  路  3Comments

jiaqianliCn picture jiaqianliCn  路  3Comments

iBek23 picture iBek23  路  3Comments

aballeras01 picture aballeras01  路  3Comments