447
Views
5
Comments
Solved
[OutSystems Data Grid Web] [DataGrid] Add group total (sum) row in datagrid
outsystems-data-grid-web
Web icon
Forge asset by OutSystems
Application Type
Traditional Web

Hi all,

can someone help me how to add a total sum row in the bottom of the screen?

Like what here is said. https://www.outsystems.com/forums/discussion/48405/group-totals/

And here is explained by the makers https://www.grapecity.com/wijmo/demos/Grid/Aggregation/Belowthedata/purejs 

Did not exactly know how I can configure or script this


Thanks!

2020-08-31 15-57-57
Tiago Miguel Pereira
Staff
Solution

Hello @Wieger Kloppenburg,

Thank you for bringing this topic to the discussion.

If I understood correctly, you just want to add the aggregates below the data just like Wijmo is doing right now - here.

I attached a sample to this message. You can take a look if you want to get a better look at what I am going to explain.

To do so, you will need to specify your grid's name (whatever you want to name it):

Then, in the preparation of the Web Screen, you will need to add a new Server action - in this case, you will need to use the Javascript action:


Now it's time to prepare the method addSumRow.

You can do that by adding the method into the Javascript of the Web Screen.

Check the code below:

var addSumRow = function(gridId){
    var gObj = GridOS.ComponentUtils.getGridObjectById(gridId);
    var grid = gObj.grid;
    grid.columnFooters.rows.push(new wijmo.grid.GroupRow());
    grid.bottomLeftCells.setCellData(0, 0, 'S');
};

This should be enough to customize your bottom row with the aggregation values from the numeric columns.

DataGridAddRowSum.oml
2026-05-06 14-57-31
Rodnei Villardo

Hi @Wieger Kloppenburg, I don't know if I understand your question, but I had to create a subtotal on my  grid recently. Take a look: 


I did it using a Local Variable to store the subtotal amount and a "for..each" control to iterate the aggregate (source of the grid), incrementing the values. like this:

I Hope to help you!


UserImage.jpg
Donny Visser

Hi, 

What I want is like this:

The total sum row in the end of the table. So that it is still part of the table instead of another field in the page. Maybe someone will know how that can be done? And don't exactly know how I can script that. The makers of the wijmo grid give that example on their forum.

2020-08-31 15-57-57
Tiago Miguel Pereira
Staff
Solution

Hello @Wieger Kloppenburg,

Thank you for bringing this topic to the discussion.

If I understood correctly, you just want to add the aggregates below the data just like Wijmo is doing right now - here.

I attached a sample to this message. You can take a look if you want to get a better look at what I am going to explain.

To do so, you will need to specify your grid's name (whatever you want to name it):

Then, in the preparation of the Web Screen, you will need to add a new Server action - in this case, you will need to use the Javascript action:


Now it's time to prepare the method addSumRow.

You can do that by adding the method into the Javascript of the Web Screen.

Check the code below:

var addSumRow = function(gridId){
    var gObj = GridOS.ComponentUtils.getGridObjectById(gridId);
    var grid = gObj.grid;
    grid.columnFooters.rows.push(new wijmo.grid.GroupRow());
    grid.bottomLeftCells.setCellData(0, 0, 'S');
};

This should be enough to customize your bottom row with the aggregation values from the numeric columns.

DataGridAddRowSum.oml
UserImage.jpg
Donny Visser
UserImage.jpg
Carlos Messias

Hi Tiago,

After adding the row to aggregate the column values, how can I reference the existing cells in the new row.

The objective is, for example, to put a negative total value in red.


Thanks,

Carlos Messias

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.