Aggregator calculating value using provided function. More...
Import Statement: | import QtModelsToolkit . |
Inherits: |
In the following example symbolsAggregator
provides list of symbols ["SNT", "ETH", "ZRX"]
. The second instance symbolsAggregator
computes maximum value of role balance
(24).
ListModel { id: sourceModel ListElement { symbol: "SNT" balance: "4" } ListElement { symbol: "ETH" balance: "14" } ListElement { symbol: "ZRX" balance: "24" } } FunctionAggregator { id: symbolsAggregator model: sourceModel initialValue: [] roleName: "symbol" aggregateFunction: (aggr, value) => [...aggr, value] } FunctionAggregator { id: maxBalanceAggregator model: sourceModel initialValue: "0" roleName: "balance" aggregateFunction: (aggr, value) => Math.max(aggr, value) }