Class ArrayModel<T>

ArrayModel wraps a JavaScript array for use in .slint views. The underlying array can be modified with the [[ArrayModel.push]] and [[ArrayModel.remove]] methods.

Type Parameters

  • T

Hierarchy (view full)

Constructors

Accessors

  • get length(): number
  • Returns the number of entries in the array model.

    Returns number

Methods

  • Returns an iterable of key, value pairs for every entry in the array.

    Returns IterableIterator<[number, T]>

  • Notifies the view that the complete data must be reload.

    Returns void

  • Notifies the view that multiple rows are added to the model.

    Parameters

    • row: number

      index of the first added row.

    • count: number

      the number of added items.

    Returns void

  • Notifies the view that the data of the current row is changed.

    Parameters

    • row: number

      index of the changed row.

    Returns void

  • Notifies the view that multiple rows are removed to the model.

    Parameters

    • row: number

      index of the first removed row.

    • count: number

      the number of removed items.

    Returns void

  • Removes the last element from the array and returns it.

    Returns T

    The removed element or undefined if the array is empty.

  • Pushes new values to the array that's backing the model and notifies the run-time about the added rows.

    Parameters

    • Rest ...values: T[]

      list of values that will be pushed to the array.

    Returns void

  • Removes the specified number of element from the array that's backing the model, starting at the specified index.

    Parameters

    • index: number

      index of first row to remove.

    • size: number

      number of rows to remove.

    Returns void

  • Returns the number of entries in the array model.

    Returns number

  • Returns the data at the specified row.

    Parameters

    • row: number

      index in range 0..(rowCount() - 1).

    Returns T

    undefined if row is out of range otherwise the data.

  • Stores the given data on the given row index and notifies run-time about the changed row.

    Parameters

    • row: number

      index in range 0..(rowCount() - 1).

    • data: T

      new data item to store on the given row index

    Returns void

  • Returns an iterable of values in the array.

    Returns IterableIterator<T>