TableVirtualizer
<ui5-table-virtualizer>
| Since 2.5.0This component is not intended to be used in a productive enviroment. The API is under development and may be changed in the future.
The ui5-table-virtualizer
component is used inside the ui5-table
to virtualize the table rows, if the overflowMode
property of the table is set to 'Scroll'.
It is responsible for rendering only the rows that are visible in the viewport and updating them on scroll.
This allows large numbers of rows to exist, but maintain high performance by only paying the cost for those that are currently visible.
Note: The maximum number of virtualized rows is limited by browser constraints, specifically the maximum supported height for a DOM element.
ES6 Module Import​
import "@ui5/webcomponents/dist/TableVirtualizer.js";
Properties​
rowHeight​
rowCount​
extraRows​
Slots​
No slots available for this component.
Events​
range-change​
Methods​
reset​
CSS Parts​
No CSS parts available for this component.
Basic Sample​
Enhance your table with virtualization capabilities by incorporating the Virtualizer feature.
For effective table virtualization, the range-change
event with its first
and last
parameters determines which rows are currently visible and need to be rendered. To ensure proper virtualization, you must set the following attributes:
-
row-count
for theTable
: This attribute specifies the total number of rows in the table. It helps the virtualizer determine the number of rows to manage. -
row-height
for theTable
: This attribute defines the height of each row in the table. Consistent row height allows the virtualizer to calculate which rows are currently visible and need to be rendered. -
position
for theTableRow
: This attribute determines the position of each row within the table. Proper positioning ensures that rows are rendered in the correct location when the user scrolls.
By setting these attributes and handling the range-change
event properly, the TableVirtualizer
can efficiently manage and render only the rows that are visible when the user scrolls.