Resizer offset with useFlexLayout #3813
Replies: 23 comments
-
+1 |
Beta Was this translation helpful? Give feedback.
-
same here |
Beta Was this translation helpful? Give feedback.
-
Same |
Beta Was this translation helpful? Give feedback.
-
Seems much worse with fewer columns: I suspect that this code here in
|
Beta Was this translation helpful? Give feedback.
-
Question, is it possible to restore the resizing logic from v6 into v7 to fix this? It works perfectly fine in v6 when using Flex. v6 Resizing Code Snippet
|
Beta Was this translation helpful? Give feedback.
-
Has anyone found a solution to this? I'm in the process of implementing react-table and I would love to use the flex layout if at all possible, but this offset issue makes the table agonizing to use. |
Beta Was this translation helpful? Give feedback.
-
I had to rollback an almost complete implementation of this table in my work because of this bug. It seems it doesn't get too much attention, so I decided to use another table. I went for AG-Grid (https://www.ag-grid.com/) and cannot complain so far. I suggest you explore alternatives other that react-table. |
Beta Was this translation helpful? Give feedback.
-
This is very easy to reproduce with just the default example of Full Width Resizable Table from the docs. Just open it up and click open in new window. For me, the resizing is completely unusuable from the start. Spent a while trying to debug my implementation until I realised it was broken from the start. Sadly, this is where I abandon my investigation into migrating from React Table 6 to 7 for now. Would also love a fix! |
Beta Was this translation helpful? Give feedback.
-
+1 here! |
Beta Was this translation helpful? Give feedback.
-
+1, still not fixed and quite crippling. |
Beta Was this translation helpful? Give feedback.
-
I'd have to agree, this is not ideal to say the least. When using From a UX perspective, most users are not accustomed to how it currently behaves and they end up dragging the mouse to where they want the final width. This results in overshot resizing. I am even aware of this behavior and I sometimes inadvertently overshoot my target. I completely understand, this is how flexbox works, but I would imagine there is some math that can be done here to maintain normal table resizing behavior. Maybe subtract the distance that was added to the column being resized from the next column? Let's say column A is 100 and column B is 100. The user resizes column A and moves the cursor to the right 50 pixels. Then column A would be 150 and column B would be 50. Would this work? I am curious if there a way put in a band-aid fix using |
Beta Was this translation helpful? Give feedback.
-
Is It may also be worth noting that |
Beta Was this translation helpful? Give feedback.
-
I think I've fixed it! I put together a little POC demonstrating column resizing where the next column offsets the resized column. Check it out in this code sandbox. It still doesn't quite follow the mouse because the offset is a fraction instead of a pixel value due to how flexbox works. In order for it to follow the mouse I'd need to know the exact pixel width of the column being resized. I'd need to expose ref where the value is an array of elements from the hook to the |
Beta Was this translation helpful? Give feedback.
-
+1, resizing doesn't work properly with |
Beta Was this translation helpful? Give feedback.
-
I got it kinda working for resizing headers here: johsunds@54333a8, you can try running the trimmed down Not sure if I'm gonna spend any more time on this as I just ran into this issue while doing some research for a future project, but thought I'd share my progress in case anyone else wants to give it a shot. |
Beta Was this translation helpful? Give feedback.
-
@austincondiff Did you end up pursuing this idea any further? I had played around with a similar idea but was having issues getting the flex widths to calculate properly when I added more than 2 columns. Would love to see an implementation of what you've proposed here! |
Beta Was this translation helpful? Give feedback.
-
@stennisrl Beyond what I've posted in that sandbox not yet. I will most likely jump back to this soon though. It really bugs me that resizing is so laggy when paired with other features. I am thinking that it is because the browser is having to calculate each rows flex layout individually on every frame of the resize. We may have better luck with Check out this table I am working on that is aimed to be fully featured and replace ag-grid in the application I am working on. Try resizing a column and notice the painful lag despite my best efforts to improve performance. 😱 (maybe this is a separate issue though) |
Beta Was this translation helpful? Give feedback.
-
Anyone managed to fix this? 😄 |
Beta Was this translation helpful? Give feedback.
-
Do we know if this is at least addressed in the v8 of react-table that is coming soon? |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
After a lot of research, a lot of this issue comes down to the quirkiness of flex-box with explicit widths. The potential solutions here are really good efforts, but nothing I think we can reliably put into the core for everyone to rely on. At the end of the day, v8 is still going to be extremely headless and if you choose to implement your layout using flex-box and need column resizing you will likely need to find a custom solution in your table markup to mitigate this issue. This discussion is still super valuable, so I'm going to move it to a discussion. |
Beta Was this translation helpful? Give feedback.
-
I see some solutions here aimed at v7, are there any solutions for v8? |
Beta Was this translation helpful? Give feedback.
-
I would also be interested in a solution for v8. We have experience a large offset which confuses users. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug (required)
When using FlexLayout with resizers and the table width is larger (1000px+), there is a noticable offset from the mouse pointer to the resizer element.
Provide an example via Codesandbox! (required)
This is the original example for useFlexLayout
https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/full-width-resizable-table
Steps To Reproduce (required)
Expected behavior (Recommended)
Usually the resizer should move the same delta x as the mouse does.
Screenshots

I have an x resolution of 1920
Desktop (please complete the following information):
I would like to help fixing this, but this is beyound my reach.
Thank you for this great project.
Beta Was this translation helpful? Give feedback.
All reactions