-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
When rendering a table with the Virtualize component, if we add a responsive class from bootstrap (which adds the following: display: block ; width: 100%; overflow-x: auto;) to the table, the Virtualize component breaks, thus loading all items on the page as if it were a traditional for loop. The main style that causes the break is the overflow-x
However, adding those style changes to the table (or adding the class from bootstrap) after the page has fully rendered and the virtualization is working, DOES NOT break the component. This means that technically we could add the css after the page has completed loading without issues, but I cannot seem to find a point in the life cycle where I can add the CSS or style from the @code block.
It would seem as though the virtualize component cannot figure out the number of rows that would occupy the page, and thus returns them all to the UI.
I tried adding an ItemSize and OverscanCount, but it makes no difference. Neither did adding an actual height on the <tr> inside the virtualize.
To Reproduce
working:
<table class="table table-sm table-hover">
<thead>..something</thead>
<tbody>
<Virtualize Items="articoli"><tr><td>..something here<td/></tr></Virtualize>
</tbody></table>
NOT working:
<table class="table table-sm table-hover" style="display: block ; width: 100%; overflow-x: auto;">
<thead>..something</thead>
<tbody>
<Virtualize Items="articoli"><tr><td>..something here<td/></tr></Virtualize>
</tbody></table>
Further technical details
- .NET 5
- VS 2019