AggregateColumn

A column, which, when used as part of a TreeGrid, aggregates the values of this column's descendants using a configured function which defaults to sum. The aggregate value is re-calculated after any change to the data, and if you want aggregate values to be change-tracked, please set includeParentInChangeSet to true.

Default editor depends on the data field type. If it is a number, default editor is a NumberField. Otherwise Default editor is a TextField.

const grid = new TreeGrid({
    // Custom aggregation handler.
    // For test purposes, this just does "sum"
    myAggregator(...values) {
        let result = 0;

        for (let i = 0, { length } = values; i < length; i++) {
            result += parseInt(args[i], 10);
        }
        return result;
    },
    columns : [
        { field : 'name', text : 'Name' },

        // Will sum the ages of leaf nodes. This is the default.
        { type : 'aggregate', field : 'age', text : 'Age', renderer : ({ value }) => `<b>${value}<b>` },

        // Will use AggregateColumn's built-in avg of scores of leaf nodes
        { type : 'aggregate', field : 'score', text : 'Score', function : 'avg' },

        // Will use the grid's myAggregator function
        { type : 'aggregate', field : 'revenue', text : 'Revenue', function : 'up.myAggregator' },
    ]
});

Configs

90

Common

Set to false to disable aggregates being calculated.

function: sum | avg | min | max | functionAlso a property

Math Function name, or function name prepended by "up." that is resolvable in an ancestor component (such as the owning Grid, or a height Container), or a function to use to aggregate child record values for this column, or a function.

This Column is provided with a sum and avg function. The default function is sum which is used for the aggregation.

The function is passed a set of child node values, each value in a separate argument and should return a single value based upon the value set passed.

ParameterTypeDescription
recordsModel[]

Records for aggregation

Returns: * -

Aggregated value

Set to true to include filtered out records in the aggregation.

Set to true to include changes to parent (aggregate) rows in the store's modification tracking.

autoWidthColumn
fieldColumn
fitModeColumn
flexColumn
largeStepNumberColumn
listenersEvents
maxNumberColumn
maxWidthColumn
minNumberColumn
stepNumberColumn
textColumn
unitNumberColumn
widthColumn

Accessibility

ariaLabelColumn

Export

Integration

vueColumn

Interaction

collapsedColumn
draggableColumn
editorColumn
groupableColumn
hideableColumn
resizableColumn
sealedColumn
sortableColumn

Layout

alignNumberColumn
hiddenColumn
lockedColumn
minWidthColumn
regionColumn

Menu

Merge cells

mergeableColumn

Misc

localeClassLocalizable
localizableLocalizable
tagsColumn
treeColumn

Other

formatNumberColumn
formulaColumn
pinnedColumn
readOnlyColumn

Rendering

cellClsColumn
clsColumn
iconColumn
rendererNumberColumn
tooltipColumn

Summary

sumColumn
summariesColumn

Properties

161

Common

Set to false to disable aggregates being calculated.

function: sum | avg | min | max | functionAlso a config

Math Function name, or function name prepended by "up." that is resolvable in an ancestor component (such as the owning Grid, or a height Container), or a function to use to aggregate child record values for this column, or a function.

This Column is provided with a sum and avg function. The default function is sum which is used for the aggregation.

The function is passed a set of child node values, each value in a separate argument and should return a single value based upon the value set passed.

ParameterTypeDescription
recordsModel[]

Records for aggregation

Returns: * -

Aggregated value

Set to true to include filtered out records in the aggregation.

Set to true to include changes to parent (aggregate) rows in the store's modification tracking.

autoWidthColumn
fieldColumn
fitModeColumn
flexColumn
largeStepNumberColumn
maxNumberColumn
maxWidthColumn
minNumberColumn
stepNumberColumn
textColumn
unitNumberColumn
widthColumn

Class hierarchy

isAggregateColumn: Boolean= truereadonly
Identifies an object as an instance of AggregateColumn class, or subclass thereof.
isAggregateColumn: Boolean= truereadonlystatic
Identifies an object as an instance of AggregateColumn class, or subclass thereof.
isColumnColumn
isEventsEvents
isLocalizableLocalizable
isModelModel
isModelLinkModelLink
isModelStmModelStm
isNumberColumnNumberColumn
isTreeNodeTreeNode

Accessibility

ariaLabelColumn

Editing

copyOfModel
isValidModel

Export

Fields

allFieldsstaticModel
autoExposeFieldsstaticModel
childrenFieldstaticModel
fieldMapstaticModel
fieldsstaticModel
idFieldstaticModel

Grouping

Identification

keyModel

Integration

vueColumn

Interaction

collapsedColumn
draggableColumn
editorColumn
groupableColumn
hideableColumn
resizableColumn
sealedColumn
sortableColumn

JSON

jsonModel

Layout

alignNumberColumn
hiddenColumn
lockedColumn
minWidthColumn
regionColumn

Lifecycle

configBase

Linked records

hasLinksModelLink
isLinkedModelLink
recordLinksModelLink

Menu

Merge cells

mergeableColumn

Misc

localeHelperLocalizable
localeManagerLocalizable
stmModelStm
tagsColumn
treeColumn

Other

$namestaticModel
defaultsColumn
elementColumn
formatNumberColumn
formulaColumn
gridColumn
pinnedColumn
readOnlyColumn
relationsstaticModel
subGridColumn
typestaticColumn
visibleColumn

Parent & children

allChildrenTreeNode
childLevelTreeNode
firstChildTreeNode
isLeafTreeNode
isLoadedTreeNode
isParentTreeNode
isRootTreeNode
lastChildTreeNode
nextSiblingTreeNode
parentTreeNode
parentIdTreeNode

Rendering

cellClsColumn
clsColumn
iconColumn
rendererNumberColumn
tooltipColumn

Summary

sumColumn
summariesColumn

Functions

77

Configuration

applyDefaultsstaticBase

Editing

copyModel
getDataModel
removeModel
setModel

Events

Fields

addFieldstaticModel
getModel
processFieldstaticModel
removeFieldstaticModel

Identification

asIdstaticModel

JSON

toJSONModel

Lifecycle

destroystaticBase

Misc

equalsModel
initClassstaticBase
isOfTypeNamestaticBase
linkModelLink
mixinstaticBase
optionalLstaticLocalizable

Other

defaultRendererNumberColumn
hideColumn
LstaticLocalizable
onEvents
relayAllEvents
showColumn
toggleColumn
triggerEvents
unEvents

Parent & children

appendChildTreeNode
bubbleTreeNode
bubbleWhileTreeNode
containsTreeNode
isExpandedTreeNode
removeChildTreeNode
traverseTreeNode

Events

5

Event handlers

5

Typedefs

2