Windowed list model interface

interface IModel<T> {
    estimateWidgetSize: ((index) => number);
    height: number;
    isDisposed: boolean;
    itemsList: null | ISimpleObservableList<T>;
    overscanCount: number;
    paddingTop?: number;
    scrollOffset: number;
    stateChanged: ISignal<WindowedList.IModel<any>, IChangedArgs<any, any, string>>;
    widgetCount: number;
    widgetRenderer: ((index) => Widget);
    windowingActive: boolean;
    dispose(): void;
    getEstimatedTotalSize(): number;
    getOffsetForIndexAndAlignment(index, align?, margin?, precomputed?, alignPreference?): number;
    getRangeToRender(): null | WindowIndex;
    getSpan(start, stop): [number, number];
    resetAfterIndex(index): void;
    setWidgetSize(sizes): boolean;

Type Parameters

  • T = any


Implemented by


estimateWidgetSize: ((index) => number)

Provide a best guess for the widget size at position index


This function should be very light to compute especially when returning the default size. The default value should be constant (i.e. two calls with null should return the same value). But it can change for a given index.

Type declaration

    • (index): number
    • Parameters

      • index: number

        Widget position

      Returns number


Estimated widget size

height: number

List widget height

isDisposed: boolean

Test whether the object has been disposed.


This property is always safe to access.

itemsList: null | ISimpleObservableList<T>

Items list to be rendered

overscanCount: number

Number of widgets to render in addition to those visible in the viewport.

paddingTop?: number

Top padding of the the outer window node.

scrollOffset: number

Viewport scroll offset.

stateChanged: ISignal<WindowedList.IModel<any>, IChangedArgs<any, any, string>>

A signal emitted when any model state changes.

widgetCount: number

Total number of widgets in the list

widgetRenderer: ((index) => Widget)

Widget factory for the list items.

Caching the resulting widgets should be done by the callee.

Type declaration

    • (index): Widget
    • Parameters

      • index: number

        List index

      Returns Widget


The widget at the given position

windowingActive: boolean

Whether windowing is active or not.


  • Dispose of the resources held by the object.


    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Get the scroll offset to display an item in the viewport.

    By default, the list will scroll as little as possible to ensure the item is fully visible (auto). You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are:

    auto - Automatically align with the top or bottom minimising the amount scrolled, If alignPreference is given, follow such preferred alignment. If item is smaller than the viewport and fully visible, do not scroll at all. smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport). If the item is less than one viewport away, scroll so that it becomes fully visible (following the auto heuristics). If the item is more than one viewport away, scroll so that it is centered within the viewport (center if smaller than viewport, top-center otherwise). center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport). top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport). end - Align the bottom of the item to the bottom of the list. start - Align the top of item to the top of the list.


    • index: number

      Item index

    • Optional align: ScrollToAlign

      Where to align the item in the viewport

    • Optional margin: number

      In 'smart' mode the viewport proportion to add

    • Optional precomputed: {
          currentOffset: number;
          itemMetadata: ItemMetadata;
          totalSize: number;

      Precomputed values to use when windowing is disabled.

      • currentOffset: number
      • itemMetadata: ItemMetadata
      • totalSize: number
    • Optional alignPreference: BaseScrollToAlignment

      Allows to override the alignment of item when the auto heuristic decides that the item needs to be scrolled into view.

    Returns number

    The needed scroll offset

  • Return the viewport top position and height for range spanning from startIndex to stopIndex.


    • start: number

      First item in viewport index

    • stop: number

      Last item in viewport index

    Returns [number, number]

    The viewport top position and its height

  • WindowedListModel caches offsets and measurements for each index for performance purposes. This method clears that cached data for all items after (and including) the specified index.

    The list will automatically re-render after the index is reset.


    • index: number

    Returns void

  • Update item sizes.

    This should be called when the real item sizes has been measured.


    • sizes: {
          index: number;
          size: number;

      New sizes per item index

    Returns boolean

    Whether some sizes changed or not