2
<ngx-datatable class="material" 
        [summaryRow]="enableSummary 
        [summaryPosition]="summaryPosition"
        [summaryHeight]="'auto'"
        [columns]="columns"
        [columnMode]="'force'"
        [headerHeight]="50"
        [rowHeight]="'auto'"
        [rows]="rows">
      </ngx-datatable>

Typescript code: here for name property i have added null as summaryFunc. still it is concatinating all the nammes

     rows = [];     
enableSummary = true;
    summaryPosition = 'top';   
    columns = [        
            { prop: 'name', summaryFunc: null, },        
            { name: 'Gender', summaryFunc: (cells) => this.summaryForGender(cells) },        
            { prop: 'age', summaryFunc: (cells) => this.avgAge(cells) },        
          ];

    private summaryForGender(cells: string[]) {    
        const males = cells.filter(cell => cell === 'male').length;    
        const females = cells.filter(cell => cell === 'female').length;
        return `males: ${males}, females: ${females}`;    
      }
    private avgAge(cells: number[]): number {    
        const filteredCells = cells.filter(cell => !!cell);    
        return filteredCells.reduce((sum, cell) => sum += cell, 0) / filteredCells.length;    
      }
vikas biradar
  • 238
  • 1
  • 3
  • 12
  • 1
    Your example is missing a quote. Right with `[summaryRow]="enableSummary`. Although I'm sure that's not causing the issue, I'm in the same boat-ish. – Ozitiho Jun 01 '18 at 09:30
  • that was not the problem. Now i have fixed it by updating the version and some code related to it. Summary row issue is fixed in 13.0.0 version. Thanks for your kind response Ozitiho – vikas biradar Jun 05 '18 at 14:57

0 Answers0