Skip to content

ArrayModel

Defined in: api/node/typescript/models.ts:239

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

T

new ArrayModel<T>(arr): ArrayModel<T>

Defined in: api/node/typescript/models.ts:250

Creates a new ArrayModel.

T[]

ArrayModel<T>

Model<T>.constructor

get length(): number

Defined in: api/node/typescript/models.ts:258

Returns the number of entries in the array model.

number

[iterator](): Iterator<T>

Defined in: api/node/typescript/models.ts:196

Iterator<T>

Model.[iterator]


entries(): IterableIterator<[number, T]>

Defined in: api/node/typescript/models.ts:395

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

IterableIterator<[number, T]>


filter(filterFunction): FilterModel<T>

Defined in: api/node/typescript/models.ts:118

Returns a new Model that only contains the rows of this model for which filterFunction returns true.

(data) => boolean

returns true if a row should be visible.

FilterModel<T>

a new FilterModel that wraps the current model.

Model.filter


insertRow(_index, _data): void

Defined in: api/node/typescript/models.ts:314

Insert a new row into the array backing the model at the specified index and notifies run-time about the added row.

number

index at which to insert the new row.

T

data item to store in the new row.

void

Model.insertRow


map<U>(mapFunction): MapModel<T, U>

Defined in: api/node/typescript/models.ts:108

Returns a new Model where all elements are mapped by the function mapFunction.

U

(data) => U

maps the data from T to U.

MapModel<T, U>

a new MapModel that wraps the current model.

Model.map


pop(): T | undefined

Defined in: api/node/typescript/models.ts:337

Removes the last element from the array and returns it.

T | undefined

The removed element or undefined if the array is empty.


push(…values): void

Defined in: api/node/typescript/models.ts:326

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

T[]

list of values that will be pushed to the array.

void


pushRow(data): void

Defined in: api/node/typescript/models.ts:292

Add a new row to the array backing the model and notifies run-time about the added row.

T

new data item to store in a new row.

void

Model.pushRow


remove(index, size): void

Defined in: api/node/typescript/models.ts:351

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

number

index of first row to remove.

number

number of rows to remove.

void


removeRow(_index): void

Defined in: api/node/typescript/models.ts:300

Remove a row from the array backing the model and notifies run-time about the removed row.

number

index of the row to remove.

void

Model.removeRow


reverse(): ReverseModel<T>

Defined in: api/node/typescript/models.ts:137

Returns a new Model with the same rows as this model, in reverse order.

ReverseModel<T>

a new ReverseModel that wraps the current model.

Model.reverse


rowCount(): number

Defined in: api/node/typescript/models.ts:265

Returns the number of entries in the array model.

number

Model.rowCount


rowData(row): T

Defined in: api/node/typescript/models.ts:274

Returns the data at the specified row.

number

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

T

undefined if row is out of range otherwise the data.

Model.rowData


setRowData(row, data): void

Defined in: api/node/typescript/models.ts:283

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

number

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

T

new data item to store on the given row index

void

Model.setRowData


sort(compareFunction): SortModel<T>

Defined in: api/node/typescript/models.ts:129

Returns a new Model with the same rows as this model, ordered according to compareFunction.

(a, b) => number

compares two rows the same way the callback passed to Array.prototype.sort does.

SortModel<T>

a new SortModel that wraps the current model.

Model.sort


splice(start, deleteCount?, …items): T[]

Defined in: api/node/typescript/models.ts:366

Removes elements from the array that’s backing the model and, if necessary, inserts new elements in their place, following the semantics of Array.prototype.splice. The run-time is notified about the removed and added rows.

number

zero-based index at which to start changing the array; negative values count back from the end and out-of-range values are clamped.

number

number of elements to remove starting at start; if omitted, all elements from start to the end are removed.

T[]

elements to insert at start.

T[]

an array containing the removed elements.


values(): IterableIterator<T>

Defined in: api/node/typescript/models.ts:388

Returns an iterable of values in the array.

IterableIterator<T>


© 2026 SixtyFPS GmbH