If you set a column to fit-content, the table applies static widths to the table header, but only based on the content of the column cells and not taking into account the column headers.
This results in the headers being cut off, which is not a behavior that you ever want, because a column header that give you no way of seeing what the header text says is a worthless header:
Instead, the script that applies the static grid template widths should check to make sure the width set does not cut off the column header, using the header width instead of the cell width is lower. In other words, if the header width is wider than the cell width, use the header width instead.
The only workaround currently is to set the cell to custom content, then set a static width on the wrapper container to force the applied width to match the expected header width. Of course this is not ideal since if you change the header text, you have to manually adjust the custom content width.
I agree this seems like a limitation of the current fit-content implementation. The column width should ideally be calculated using the maximum width required by either the header or the cell content. Otherwise, long header labels can get truncated even when there is sufficient space to display them.
Using only the cell content to determine the width makes the header difficult or impossible to read, which defeats its purpose. Your workaround with a fixed-width wrapper works, but it is not maintainable since any header text change requires manual width adjustments.
It would be better if DataGrid2 automatically considered both header and cell widths when calculating fit-content column sizes.
Hello
I have the same problem. Did you find any solution??