Important

You are browsing upcoming documentation for version 6.1 of OroCommerce, scheduled for release in 2025. Read the documentation for version 6.0 (the latest LTS version) 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 aggregation of the total, which is displayed in the grid’s footer (tfoot).

Settings 

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

datagrids:
  demo:
    source:
       [...]
    totals:
      page_total:
          extends: grand_total
          per_page: true
          hide_if_one_page: true
          disabled: false
          columns:
            name:
                label: 'page total'
      grand_total:
          columns:
            name:
                label: 'grand total'
            contactName:
                expr: 'COUNT(o.name)'
                formatter: integer
            closeDate:
                label: 'Oldest'
                expr: 'MIN(o.closeDate)'
                formatter: date
            probability:
                label: 'Summary'
                expr: 'SUM(o.probability)'
                formatter: percent
            budget:
                label: 'Budget Amount'
                expr: 'SUM(o.budget)'
                formatter: currency
                divisor: 100
            statusLabel:
                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 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.

  • if disabled is true, this total row is removed.

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

Related Articles