FilterModel
Defined in: api/node/typescript/models.ts:457 ↗
FilterModel provides a filtered view of rows from a source model, by applying
a filter function to each row of the source model. Only rows for which the
filter function returns true are visible in the FilterModel.
Example
Section titled “Example”const source = new ArrayModel([1, 2, 3, 4, 5, 6]);const evenNumbers = new FilterModel(source, (x) => x % 2 === 0);
// prints 2, 4, 6for (const x of evenNumbers) { console.log(x);}Extends
Section titled “Extends”Model<T>
Type Parameters
Section titled “Type Parameters”T
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FilterModel<
T>(sourceModel,filterFunction):FilterModel<T>
Defined in: api/node/typescript/models.ts:473 ↗
Constructs a new FilterModel that provides a filtered view on the given
sourceModel by applying filterFunction on each of its rows.
Parameters
Section titled “Parameters”sourceModel
Section titled “sourceModel”Model<T>
the wrapped model.
filterFunction
Section titled “filterFunction”(data) => boolean
returns true if a row should be visible in the FilterModel.
Returns
Section titled “Returns”FilterModel<T>
Overrides
Section titled “Overrides”Model<T>.constructor
Properties
Section titled “Properties”sourceModel
Section titled “sourceModel”
readonlysourceModel:Model<T>
Defined in: api/node/typescript/models.ts:461 ↗
The source model that this FilterModel filters rows from.
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T>
Defined in: api/node/typescript/models.ts:232 ↗
Returns
Section titled “Returns”Iterator<T>
Inherited from
Section titled “Inherited from”filter()
Section titled “filter()”filter(
filterFunction):FilterModel<T>
Defined in: api/node/typescript/models.ts:154 ↗
Returns a new Model that only contains the rows of this model for which
filterFunction returns true.
Parameters
Section titled “Parameters”filterFunction
Section titled “filterFunction”(data) => boolean
returns true if a row should be visible.
Returns
Section titled “Returns”FilterModel<T>
a new FilterModel that wraps the current model.
Inherited from
Section titled “Inherited from”insertRow()
Section titled “insertRow()”insertRow(
_index,_data):void
Defined in: api/node/typescript/models.ts:226 ↗
Implementations of this function must add a row at the specified index, pushing all next rows to the right.
Parameters
Section titled “Parameters”_index
Section titled “_index”number
index of the row to insert.
T
new data item to store in a new row.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”map<
U>(mapFunction):MapModel<T,U>
Defined in: api/node/typescript/models.ts:144 ↗
Returns a new Model where all elements are mapped by the function mapFunction.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”mapFunction
Section titled “mapFunction”(data) => U
maps the data from T to U.
Returns
Section titled “Returns”MapModel<T, U>
a new MapModel that wraps the current model.
Inherited from
Section titled “Inherited from”pushRow()
Section titled “pushRow()”pushRow(
_data):void
Defined in: api/node/typescript/models.ts:204 ↗
Implementations of this function must add a line to the model with the provided data.
Parameters
Section titled “Parameters”T
new data item to store in a new row.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”removeRow()
Section titled “removeRow()”removeRow(
_index):void
Defined in: api/node/typescript/models.ts:214 ↗
Implementations of this function must remove the row at the specified index.
Parameters
Section titled “Parameters”_index
Section titled “_index”number
index of the row to remove.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”reset()
Section titled “reset()”reset():
void
Defined in: api/node/typescript/models.ts:632 ↗
Re-applies the filter function on each row of the source model. Use this if the filter function depends on state external to the source model and that state has changed.
Returns
Section titled “Returns”void
reverse()
Section titled “reverse()”reverse():
ReverseModel<T>
Defined in: api/node/typescript/models.ts:173 ↗
Returns a new Model with the same rows as this model, in reverse order.
Returns
Section titled “Returns”ReverseModel<T>
a new ReverseModel that wraps the current model.
Inherited from
Section titled “Inherited from”rowCount()
Section titled “rowCount()”rowCount():
number
Defined in: api/node/typescript/models.ts:594 ↗
Returns the number of entries in the filtered model.
Returns
Section titled “Returns”number
Overrides
Section titled “Overrides”rowData()
Section titled “rowData()”rowData(
row):T|undefined
Defined in: api/node/typescript/models.ts:603 ↗
Returns the data at the specified row.
Parameters
Section titled “Parameters”number
index in range 0..(rowCount() - 1).
Returns
Section titled “Returns”T | undefined
undefined if row is out of range otherwise the data.
Overrides
Section titled “Overrides”setRowData()
Section titled “setRowData()”setRowData(
row,data):void
Defined in: api/node/typescript/models.ts:619 ↗
Stores the given data in the source model at the row that corresponds to the given filtered row index. The source model’s own change notification is what drives re-evaluating the filter for that row (see the class docs), so this simply forwards the write.
Parameters
Section titled “Parameters”number
index in range 0..(rowCount() - 1).
T
new data item to store on the given row index.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”sort()
Section titled “sort()”sort(
compareFunction):SortModel<T>
Defined in: api/node/typescript/models.ts:165 ↗
Returns a new Model with the same rows as this model, ordered according to
compareFunction.
Parameters
Section titled “Parameters”compareFunction
Section titled “compareFunction”(a, b) => number
compares two rows the same way the callback passed to Array.prototype.sort does.
Returns
Section titled “Returns”SortModel<T>
a new SortModel that wraps the current model.
Inherited from
Section titled “Inherited from”unfilteredRow()
Section titled “unfilteredRow()”unfilteredRow(
filteredRow):number|undefined
Defined in: api/node/typescript/models.ts:643 ↗
Given a filteredRow index into this FilterModel, returns the
corresponding row index in the source model.
Parameters
Section titled “Parameters”filteredRow
Section titled “filteredRow”number
index in range 0..(rowCount() - 1).
Returns
Section titled “Returns”number | undefined
undefined if filteredRow is out of range otherwise the source row index.
© 2026 SixtyFPS GmbH