-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
The react table example doesn't make the <table> element large enough #585
Comments
@KOVIKO you can't really position: sticky; on also for tables better is to avoid the absolute positioning of virtualized items #476 |
That ticket was very useful for knowing the correct way to do the padding-rows approach! Thank you for that! As far as sticky If we change the <th
key={header.id}
colSpan={header.colSpan}
style={{
width: header.getSize(),
position: 'sticky',
top: 0,
zIndex: 2,
}}
> |
hmm hard to say what is happening, but sticky should work, here virtualization is not adding anything special, like https://codesandbox.io/s/virtual-simple-table-cdqqpg |
That example you just provided is using row(s) for padding to keep the It's in the <tr key={row.id}
style={{
height: `${virtualRow.size}px`,
transform: `translateY(${virtualRow.start - index * virtualRow.size}px)`,
}}> To be clear, this isn't necessarily a bug of |
Yep, i agree that table examples are misleading, we should not use the absolution positions here. |
@KOVIKO Thanks - your solution worked for me! I'd suggest doing this slightly differently:
If the table rows are all fixed height - the calculation for all rows will be the same as the first virtual item. |
This approach helped me when using
|
This worked out for me! I added the |
Friendly bump on this issue. |
Describe the bug
In the "React Virtual Table Example", the
translateY
approach to row positioning allows rows to be positioned outside of the<table>
element.This causes issues with at least two things:
<thead style="position:sticky;top:0">
) cannot go beyond the bounds of the<table>
element<tr>
elements stop displaying when the<tr>
element is outside of the bounds of the<table>
element (in Chrome & Firefox)It's also worth noting that intentionally changing the size of the table causes the rows to become huge, so that doesn't appear to be a solution.
Unless something can be done about the size of the
<table>
element, it may be best to suggest the padding-rows approach (such as the one used in the "React Table Virtualized Rows Example" in the TanStack Table docs).Your minimal, reproducible example
https://tanstack.com/virtual/v3/docs/examples/react/table
Steps to reproduce
<thead>
to a sticky header (<thead style="position:sticky;top:0">
)Expected behavior
<thead style="position:sticky;top:0">
should remain sticky through the entire table's scrolling.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
tanstack-virtual version
3.0.0-beta.60
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: