I'm using angular Infragistics UI grid in typescript 12
And I'm trying to calculate the totale of the price field when the grid is in group by mode. Say I have 2 groups by client, group 1 contained 2 items and group 2 contained 3 items. I have to get the total price by each grouped client (for example 300 for group1 and 800 for the second).
Here is my code in HTML component
<igx-grid #grid id="grid" [data]="listeinvoices" [groupingExpressions]='expr' [allowFiltering]="true" [autoGenerate]="false" height="500px">
<igx-column field="client" header="client" [groupable]="true"></igx-column>
<igx-column field="price" header="price" [groupable]="true"></igx-column>
<igx-column field="invoicenumber" header="invoice nb" [groupable]="true"></igx-column>
</igx-grid>
The code of ts component :
export class FactureComponent implements OnInit {
public expr: ISortingExpression[];
@ViewChild("grid") public grid!: IgxGridComponent;
constructor(private rest: RestService,private toastr: ToastrService,private excelExportService: IgxExcelExporterService)
{
this.expr = [
{ dir: SortingDirection.Asc, fieldName: 'client', ignoreCase: false,
strategy: DefaultSortingStrategy.instance() },
];
}
}
In that case you can use the Group Row template and structure it as you wish. Check out the documentation, I believe you will find it helpful:
You can define your own Row Selector template as well