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

[Table] prop Table.columnWidths breaks column resizing #3833

Closed
zwerg44 opened this issue Nov 11, 2019 · 12 comments
Closed

[Table] prop Table.columnWidths breaks column resizing #3833

zwerg44 opened this issue Nov 11, 2019 · 12 comments

Comments

@zwerg44
Copy link
Contributor

zwerg44 commented Nov 11, 2019

Hello.

Looks like setting initial column width with Table.columnWidths breaks column resizing starting from @blueprintjs/[email protected].
Version 3.8.0 - seams working.

Environment

Link to a minimal repro: https://codesandbox.io/s/blueprint-sandbox-l4l11

Steps to reproduce

  1. Create component with defined Table.columnWidths and resizable columns.
  2. Try to resize column with mouse.

Actual behavior

The layout looks broken like this
image

Possible solution

Don't have solution, I rolled back to package previous version.

@anurag060
Copy link

Did anyone find a work arround for this issue?
Hi @zwerg44 ... you got this fixed?

@zwerg44
Copy link
Contributor Author

zwerg44 commented Apr 22, 2020

Hi @anurag060
No, I rolled back versions, I still at:
"@blueprintjs/core": "3.18.1",
"@blueprintjs/datetime": "3.13.0",
"@blueprintjs/select": "3.10.0",
"@blueprintjs/table": "3.7.1",

@bheklilr
Copy link

I've also experienced this issue. I attempted to work around it by keeping up with the column widths in a state variable and using the onColumnWidthChanged handler, but I happened to notice that when the table has to horizontally scroll I get a weird glitch on resize. Any columns to the right of the one that was just resized are blanked out and completely white (pic attached). The cells still exist and I can select them with a click. As soon as I scroll horizontally it renders properly. Sometimes it seems that react will just trigger a render anyway and it'll come back.

Glad to know there is a workaround to pin at 3.8.0 for now.

image

@bsdis
Copy link

bsdis commented Jul 1, 2020

I also have this issue. Any plan of fixing it?

@adolfogarcia
Copy link

Was this issue ever fixed?

@alecf
Copy link
Contributor

alecf commented Oct 19, 2020

I am seeing this in 3.8.17

@aamirbutt
Copy link

I am seeing the same issue on 3.8.17. Any update about an ETA for the fix?

@lanzhenw
Copy link

I am using 3.8.26. I use columnWidth and onColumnWidthChanged for setting default column width. I thought I would also have this issue, but it didn't break column resizing. It was working fine.

@MartinDawson
Copy link

I am using 3.8.26. I use columnWidth and onColumnWidthChanged for setting default column width. I thought I would also have this issue, but it didn't break column resizing. It was working fine.

Please give an example because this doesn't really make sense as it isn't the correct function to use for this.

@MartinDawson
Copy link

MartinDawson commented Apr 27, 2021

#3771

^ above PR broke it

3.80 works, 3.8.1 table PR broke it. Seems to be this file: https://github.com/palantir/blueprint/pull/3771/files

table.tsx change.

I'm gonna attempt to fix it now cause this bug is critical and we need to update.

@MartinDawson
Copy link

MartinDawson commented Apr 27, 2021

Here is the issue: https://github.com/palantir/blueprint/pull/3771/files

let { columnWidths, rowHeights } = props;
        if (columnWidths == null) {
            columnWidths = state.columnWidths;
        }
        if (rowHeights == null) {
            rowHeights = state.rowHeights;
        }

It is never setting the columnWidths if they are supplied by props due to it being in 'controlled' mode.

  const [columnWidths, setColumnWidths] = useState([200, 200, 150, 150]);
<Table 
        columnWidths={columnWidths}
        onColumnWidthChanged={(index, width) => {
          const newColumnWidths = [...columnWidths];

          newColumnWidths[index] = width;

          setColumnWidths(newColumnWidths);
        }}

        />

Although there's still a major issue that the cells go white blank if you update the columnWidths and such.

@adidahiya
Copy link
Contributor

this should be fixed in table v4.0.0-rc.1. if it's not, let me know and I'll re-open.

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

10 participants