Get aggregate value from grid in component

I have a form and grid below it in my page. Form has a field where user can enter total amount and the grid has the item details - itemId, itemName, itemAmount.
I'm using aggregate service to show the sum of itemAmount in the footer template. When the user clicks submit I want to check if the total amount entered in the form is equal to the itemAmount sum shown at the bottom of the grid.

Is it possible to get the aggregate sum of itemAmount in the component.ts, so that I can compare these 2 values?

3 Replies 1 reply marked as answer

BS Balaji Sekar Syncfusion Team November 5, 2020 08:54 AM UTC

Hi Meris, 

Greetings from the Syncfusion support. 

Is it possible to get the aggregate sum of itemAmount in the component.ts,  

Based on your query we suspect that you want access the aggregate values when the user clicks submit from form. Since we have achieved your requirement in the external button click action. You can get the aggregate details using aggregateModule.footerRenderer.aggregates.aggregates from grid instance. 

Please refer the below code example for more information  

[app.component.ts] 
customFn(){ 
 this.grid.aggregateModule.footerRenderer.aggregates.aggregates["Freight - average"]; 
// Freight as aggregate column and average as aggregate 


Please get back to us, If you need further assistance. 

Regards, 
Balaji Sekar 


Marked as answer

MS Meris S November 6, 2020 05:52 PM UTC

Thanks, this works perfectly.


BS Balaji Sekar Syncfusion Team November 9, 2020 04:26 AM UTC

Hi Meris, 
  
We glad that your issue has been fixed.  
  
Please get back to us if you require further other assistance from us. 
  
Regards, 
Balaji Sekar. 


Loader.
Up arrow icon