Important

You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Totals Extension

This extension provides the totals aggregation, which are displayed in grid’s footer (tfoot).

Settings

The totals setting should be placed under the totals tree node.

 1 datagrids:
 2   demo:
 3     source:
 4        [...]
 5     totals:
 6       page_total:
 7           extends: grand_total
 8           per_page: true
 9           hide_if_one_page: true
10           columns:
11             name:
12                 label: 'page total'
13       grand_total:
14           columns:
15             name:
16                 label: 'grand total'
17             contactName:
18                 expr: 'COUNT(o.name)'
19                 formatter: integer
20             closeDate:
21                 label: 'Oldest'
22                 expr: 'MIN(o.closeDate)'
23                 formatter: date
24             probability:
25                 label: 'Summary'
26                 expr: 'SUM(o.probability)'
27                 formatter: percent
28             budget:
29                 label: 'Budget Amount'
30                 expr: 'SUM(o.budget)'
31                 formatter: currency
32                 divisor: 100
33             statusLabel:
34                 label: oro.sales.opportunity.status.label

Note

  • Column name should be equal to the name of the corresponding column.

  • label can be a text or a translation placeholder (not required)

  • expr data aggregation SQL expression (not required)

  • formatter backend formatter that processes the column value

  • available values: date, datetime, decimal, integer, percent

  • if you add “label” and “query” config but the query aggregation returns nothing -> the total’s cell will be empty

  • generally they are be shown as “<label>: <query result>

  • the total config can be taken from another total row with the extends parameter.

  • per_page parameter switches data calculation only for the current page data

  • if hide_if_one_page is true, then this total row is hidden on full data set.

  • divisor if you need to divide the value by a number before rendering it to the user (not required)