Hi Mr J GEORGE,
Thanks for contacting Syncfusion support.
You can achieve your requirement by using the “Custom
Aggregate” feature of the Grid component. Using this you can do the
calculations as per your requirement and return the value which will be
displayed in the summary cell. Please refer to the below code example and
Documentation link for more information.
|
@Component({
selector: 'app-root',
template: `<ejs-grid [dataSource]='data' height='268px'>
. . .
<e-aggregates>
<e-aggregate>
<e-columns>
<e-column columnName="ShipCountry"
format="P" type="Custom" [customAggregate]="customAggregateFn">
<ng-template #footerTemplate let-data>Brazil Count: {{data.Custom}}</ng-template>
</e-column>
</e-columns>
</e-aggregate>
</e-aggregates>
</ejs-grid>`
})
export class AppComponent implements OnInit {
public data: object[];
public ShipCountry = 'ShipCountry';
ngOnInit(): void {
this.data = data;
}
public customAggregateFn = (sdata: ReturnType) =>
sdata.result.filter((item: object) => item[this.ShipCountry] === 'Brazil').length
}
|
Documentation: https://ej2.syncfusion.com/angular/documentation/grid/aggregates/custom-aggregate/
Please get back to us if you need further assistance on
this.
Regards,
Pavithra S