VirtualScrollerLayout
Framework-neutral DOM layout adapter for VirtualScroller.
Remarks
It keeps the scroll-size element and rendered-items element synchronized without scheduling framework renders. Framework adapters expose it through their native ref, action, or controller primitives. See the layout-elements guide for the required nesting and the role of each element.
Constructors
Constructor
new VirtualScrollerLayout(model): VirtualScrollerLayout;Create a DOM layout adapter for one model.
Parameters
model
Returns
VirtualScrollerLayout
Methods
dispose()
dispose(): void;Disconnect every element and event listener owned by this adapter.
Returns
void
setItemsElement()
setItemsElement(element): void;Connect or disconnect the rendered-items element.
Parameters
element
HTMLElement | null
Returns
void
setScrollerElement()
setScrollerElement(element): void;Attach or detach the scroller element.
Parameters
element
HTMLElement | null
Returns
void
setSizeElement()
setSizeElement(element): void;Connect or disconnect the native size element.
Parameters
element
HTMLElement | null
Returns
void
Related examples
- Vanilla ListcoreThis standalone example shows the framework-neutral VirtualScroller and VirtualScrollerLayout APIs with ordinary DOM nodes. It demonstrates range rendering, item measurement, offset/index conversion, programmatic scrolling, and measurement invalidation without a framework adapter.
- Live FeedcoreThis example appends variable-height messages while demonstrating end-anchor behavior: a reader at the end stays at the newest message, while a reader who scrolled upward keeps the current viewport.
- Tanstack TablecoreThis example combines TanStack Table v9 sorting and filtering row models with AF Virtual Scroll. TanStack owns the headless table state; the virtual scroller renders and measures only the visible rows while preserving stable row identity.