[Data Grid Web] [Data Grid Web] Create Calculated Column, display SUM in other panel?
Forge component by OutSystems R&D
Published on 14 Dec 2020


I have a sample grid as below. 

I created "Total" Column = Hours * Cost (follow https://www.grapecity.com/wijmo/demos/Grid/Aggregation/Customaggregation/purejs).

Can I have sum of "Total" column for each "Type" and for all "Type" then display them to "Summary" panel?


Rank: #515

Hi Hung,

Yes, you can. 

Create a Structure with TypeName and Total attributes.

Create an Aggregate and use a group by on Type:

  • right click on the column
  • choose Group by <column name> (in this case, Ty´pe)
  • right click on the Total column
  • choose Sum.

This Aggregate will return the Sum of Total column to each Type.

Iterate over the result and put it in a list of the structure you have created. While iterating, gather the total values in order to have the total for all types. When its over, add another structure on the list, but, now, with TypeName "Total" and the sum of the Totals.

Put the list inside a List Records.

Hope this could help.

Best Regards.

Rank: #22817

Thank Kadu,

I want the sum of the Totals will be updated when I update Cost or Hours.

Can your solution handle that? I think it can not, right?


Rank: #515

Hi Hung, 

Well, it will handle, but the way It will handle it depends on how you are updating those values. 

If you are using ajax, you will need to iterate the aggreate again after its refresh and then refresh the sum of the Totals Container.

If you aren't using ajax, the preparation will run again and that is all you need.

Rank: #22817


I'm trying with js only to avoid delay when calling to server.

I tried to use collectionChanged event and it seems to work.

Rank: #841

Hi Hung,

You can refer to this video for auto calculate when user input data on Data Grid:


>>then display them to "Summary" panel? 

Use global variable to save total and set it into Expression

Rank: #22817

Thank Huyen, 

I have an other question. Can we have an an select column and allow input value not in list?

Rank: #565

Hello Hung,

Your last question should be on another topic, but I would that you can't.

The dropdown's options needs to have a Id and Label, if you have no Id yet you should first register the new option.

Kind regards