@nospamproxy/core
    Preparing search index...

    Data model for all lists that stores items, the number of items, paging information and the selection.

    Type Parameters

    • T
    Index

    Constructors

    Properties

    activity?: ActivityManager

    The activity manager that is used for error handling.

    context?: QueryContext<T>

    The query context to use for fetching data if this is a remote list model.

    odata?: OData

    The odata instance to use for fetching data if this is a remote list model.

    Accessors

    • get allItems(): readonly T[] | undefined

      A readonly array of all items if this is an in-memory list model.

      To modify items in memory, either replace the entire list model or use the API supported by the list model.

      Returns readonly T[] | undefined

    • get countPromise(): Promise<void>

      A promise that resolves when the total count is loaded.

      This promise may be replaced at any time even if the previous one is not yet resolved.

      Returns Promise<void>

    • get hasNextPage(): boolean

      True, if there is a next page.

      Returns boolean

    • get isUnknownPageCount(): boolean

      True, if the total count is permanently unknown.

      Returns boolean

    • get items(): readonly T[]

      Get the current page of items.

      Returns readonly T[]

      The current page all items if paging is disabled.

    • get pageCount(): number | undefined

      Get the total number of pages.

      Returns number | undefined

      The number of pages or undefined if paging is disabled or the total item count is not yet known. This returns at least 1 if there are no items.

    • get pageIndex(): number

      Get the current page index.

      Returns number

    • set pageIndex(value: number): void

      Set the current page index.

      Parameters

      • value: number

      Returns void

    • get pagePromise(): Promise<void>

      A promise that resolves when the current page is loaded.

      This promise may be replaced at any time even if the previous one is not yet resolved.

      Returns Promise<void>

    • get pageSize(): number | null

      Get the number of items per page.

      Returns number | null

      The page size or null if paging is disabled.

    • get selectedCount(): number

      Get the current number of selected indices.

      Returns number

    • get selectedItem(): T | undefined

      Get the first selected item.

      Returns T | undefined

    • get singleSelectedIndex(): number | undefined

      Get the only selected index within the current page.

      Returns number | undefined

      The index or undefined if there isn't exactly one selected index.

    • get totalCount(): number | undefined

      Get the total item count.

      Returns number | undefined

      The total count or undefined if it is not yet known.

    Methods

    • Abort the current page request.

      Returns void

    • Clear the selection.

      Returns void

    • Create a clone of this in-memory list model.

      • The current selection is preserved.
      • Paging is not preserved.

      Parameters

      • OptionalmapItem: (item: T) => T

        Optional function to process each item. By default, all items are re-used.

      Returns ListModel<T>

    • Get a sorted array of all selected indices on the current page.

      Returns number[]

    • Get an array of all selected items in any order.

      Returns T[]

    • Check if the specified index is selected.

      Parameters

      • index: number

      Returns boolean

    • Move the currently selected item down.

      Returns void

    • Move the currently selected item up.

      Returns void

    • Queue a task to run once when this list model has been refreshed.

      Parameters

      • task: () => void

      Returns void

    • Schedule refreshing the current page in the next microtask.

      Returns void

    • Remove an item by it's index on the current page.

      • This also clears the selection.
      • When the current page is empty after removing, the previous page is loaded.

      Parameters

      • index: number

      Returns void

      An error if this is a remote list model or the index is out of range.

    • Select all items.

      Returns void

    • Copy the selection from another list model.

      Parameters

      Returns void

    • Select a single item at the specified index.

      Parameters

      • index: number

      Returns boolean

      False if the index was out of range.

    • Select a single item.

      Parameters

      • item: T

      Returns void

    • Select a single range of items by index.

      Indices may be specified in any order and may be out of range.

      Parameters

      • from: number

        The inclusive start index.

      • to: number

        The inclusive to index.

      Returns void

    • Set the selection. This replaces the entire selection.

      Parameters

      • indices: number[]

        The indices to select. Indices out of range are ignored.

      Returns void

    • Apply sorting to this model.

      If this is a remote model, the sorting is applied to the context, else the allItems array is sorted in memory.

      Parameters

      Returns void

    • Toggle the selection of a range of items by index. Previously selected items outside the range are preserved.

      Parameters

      • from: number

        The inclusive start index.

      • to: number

        The inclusive end index. If this index will toggle to selected, all items in the range are selected, else all items in the range are deselected.

      • Optionalselect: boolean

        Wether to select or deselect the range or undefined to toggle.

      Returns void

    • Toggle the selection at a specific index.

      Parameters

      • index: number

        The index to toggle. This may be out of range.

      • Optionalselect: boolean

        Wether to select or deselect the index or undefined to toggle.

      Returns boolean