Ngx-datatable: summaryTemplate prevents summaryFunc from being invoked

Created on 18 Jun 2019  路  1Comment  路  Source: swimlane/ngx-datatable








I'm submitting a ... (check one with "x")

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior

When using summaryFunc and summaryTemplate with a column, the function is never called. Only when summaryTemplate is removed, the summaryFunc is being invoked.

Expected behavior

summaryFunc should be invoked when using a template, too

Reproduction of the problem

As I am using translations in all of my template (via pipes) I' bound to use templates, too. In the following markup the summaryFunc will only be invoked if summaryTemplate is removed:

<ngx-datatable  
        [rows]="rawData"  
        columnMode="force"  
        [rowHeight]="50"  
        [summaryRow]="true"  
        summaryPosition="bottom"  
        [summaryHeight]="'auto'"  
        [messages]="{  
            'emptyMessage': ( 'ui.noDataAvailable' | translate )  
        }"  
        [scrollbarH]="false">  
        <ngx-datatable-column   
            [name]=" 'reports.fields.employee' | translate "  
            [summaryTemplate]="summEmp"  
            [summaryFunc]="summUniques"  
            prop="employeeId"   
            [cellTemplate]="nameTmp"></ngx-datatable-column>  
</ngx-datatable>  
<ng-template #summEmp let-value="value">  
<span>{{ value }} {{ 'ui.specimenKey' | translate }}</span>  
</ng-template> 

The template _is_ being shown, albeit empty. If I remove summaryFunc from the markup, I get no value in the template. If I remove summaryTemplate I get the value displayed (but obviously not via my template).

It seems like #1485 is related to this.

What is the motivation / use case for changing the behavior?

It is sometimes very helpful to label the summary values, especially so when they represent a sum of something different, then the values in the column itself (or a derived value of those values, like uniques, length, etc).

Please tell us about your environment:

OSX 10.14.5

  • Table version:

    15.0.2

  • Angular version:

    Angular 7.2.11

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    Typescript 3.2.4

>All comments

Hello! Any update for this issue?

Was this page helpful?
0 / 5 - 0 ratings