T
TanStack16mo ago
eastern-cyan

Stop table header shifting ...

Hey all, I just wondered what strategies people were employing to stop table headers from shifting so much when loading in data ... I'd be curious to see what people are employing ...
9 Replies
adverse-sapphire
adverse-sapphire16mo ago
minWidths?
eastern-cyan
eastern-cyanOP16mo ago
Is that something that can be added in the columns declaration, or do you implement via css? I've tried the minSize and maxSize route within the columns declaration, but there is still a tonne of shifting. I was thinking I might apply my own grid styles ...
adverse-sapphire
adverse-sapphire16mo ago
minSize and maxSize will have no effect unless you actually apply them in your CSS/styles to the headers.
other-emerald
other-emerald16mo ago
can you please show an example? Did`nt saw any in documentation
adverse-sapphire
adverse-sapphire16mo ago
adverse-sapphire
adverse-sapphire16mo ago
thought it should be self explanatory
<th
key={header.id}
colSpan={header.colSpan}
style={{ width: `${header.getSize()}px`, minWidth: `${header.column.columnDef.minSize}px`, /*etc*/ }}
>
<th
key={header.id}
colSpan={header.colSpan}
style={{ width: `${header.getSize()}px`, minWidth: `${header.column.columnDef.minSize}px`, /*etc*/ }}
>
other-emerald
other-emerald16mo ago
thanks! but column still is wider than minSize.
adverse-sapphire
adverse-sapphire16mo ago
well, that's how min-width css works
other-emerald
other-emerald15mo ago
yep, i know (

Did you find this page helpful?