Virtual List
Virtual List allows to render lists with huge amount of elements without loss of performance. And it is fully compatible with all Framework7 components which work with lists such as Search Bar, Infinite Scroll, Pull To Refresh, Swipeouts (swipe-to-delete) and Sortable.
Virtual List HTML layout is pretty simple, it is almost the same as for usual List View with only difference: you need to leave it empty:
Where:
- - required additional class on any list block that uses Virtual List
Virtual List App Methods
Now, when we have list’s HTML, we need to initialize it. We need to use required App method:
- Method returns initialized Virtual List instance
app.virtualList.destroy(el)- destroy Virtual List instance
- el - HTMLElement or string (with CSS Selector) or object. Virtual List element or Virtual List instance to destroy.
app.virtualList.get(el)- get Virtual List instance by HTML element
- el - HTMLElement or string (with CSS Selector). Virtual List element.
Method returns Virtual List’s instance
Note that Virtual List container (list block element) should be in DOM on a moment of initialization.
Virtual List Methods & Properties
So to create Virtual List we have to call:
After we initialize Virtual List we have its initialized instance in variable (like virtualList
variable in example above) with helpful methods and properties:
Virtual List will fire the following events on app and virtual list instance:
Virtual List instance emits events on both self instance and app instance. App instance events has same names prefixed with vl
.