angular-ui/ui-grid

Grouppriority default treeAggregationFn overwrite bug

Open

#5.123 aberto em 16 de fev. de 2016

Ver no GitHub
 (2 comments) (1 reaction) (0 assignees)JavaScript (2.496 forks)batch import
good first issuegrid-grouping

Métricas do repositório

Stars
 (5.395 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

According to the docs the groupingColumnBuilder function should get one of the default aggregations when the groupPriority is undefined or less then 0, however, in the code it does otherwise:

If the groupPriority is undefined or less than 0, then we expect to be aggregating, and we look at the aggregation types to determine what sort of aggregation we can do. Values are in the constants file, but include SUM, COUNT, MAX, MIN

if ( typeof(col.grouping.groupPriority) !== 'undefined' && col.grouping.groupPriority > -1 ){
    col.treeAggregationFn = uiGridTreeBaseService.nativeAggregations()[uiGridGroupingConstants.aggregation.COUNT].aggregationFn;
    col.treeAggregationFinalizerFn = service.groupedFinalizerFn;
}

As you see in the above code, it actually checks for !== 'undefined' && > -1, which overwrites a possible custom set treeAggregationFn with a default one.

This above code is taken from the current release, line #18959

Guia do colaborador