Infinite scroll
Infinite scroll allows fetching and displaying data sequentially as the user scrolls down to the end of the container. A container can be a table, a list, a flex box, etc. This is an alternative to using pagination links.
How to use
- The feature element-plus must be enabled, therefore the preference
elementplus_infinite_scrollenabled as well. Note that this will not be effective for tables using thejQuery table sorterfeature. - After activating all required preferences, all lists with pagination will no longer display a pagination module, instead opting for a scrollable container. i.e, the following image:
Another way of using it is within a wiki page, typically with a PluginHTML.
Use within a wiki page.
Sample markup:
Copy to clipboard
<el-infinite-scroll container-id="container" target-container-id="sub-container" offset="0" step="20" total-count="100"></el-infinite-scroll>
Basically, we get a new HTML tag "el-infinite-scroll", which can take some attributes:
| Attribute | Description | Required | Default value | |
| container-id | The id of the element present in the DOM, containing scrollable items | True | - | |
| target-container-id | The id of the sub-element of the container, containing directly scrollable items. This attribute is mostly relevant for tables, in which case the id should reference the tbody element. | False | - | |
| offset | The number specifying the starting index of elements to be displayed in the total set | False | 0 | |
| step | The number of elements to fetch on the next scroll | True | - | |
| total-count | The number specifying the length of elements available to the server | True | - | |
| offset-arg | A string specifying which url parameter will hold the offset value when a request is made to the server | False | offset | |
Please Note:
- The element referenced
container-idandtarger-container-idmust be present in the DOM before using theinfinite-scrollwrapper. - The
infinite-scrollwrapper does not fetch initial items, so these must be present in the rendered container; otherwise, scrolling will not be possible with no items rendered. - When fetching more items, the current window URL is used with appropriate route parameters.