adds a custom total operation

void addTotalOperation(string name,function operation,object options);


namestringthe name of the operation
operationfunctionthe logic of the operation
optionsobjectan object with operation options: leavesOnly or ids properties (see details)


$$("pivot").addTotalOperation("wAver", function(values, key, data) {
    // make the neccessary calculations and return the resulting value
}, {leavesOnly: true});

Related samples


This method is applied to the Pivot Table only.

The method creates a custom operation for calculating values for total column and column footers.

The operation function takes the following parameters:

  • values - (array) the values calculated for this operation in the row (in the column in case of the footer)
  • key - (string) the ID of the current grid column
  • data - (object) the data item (for the "Total" column) or an array of items (for columns' footers) for which totals are calculated

The leavesOnly option takes a boolean value. If set to true, the operation function will take only values of leaves child rows (rows that do not have sub-rows).

The ids option takes a boolean value. If the property is set to true, the operation function will take ids of ungrouped data items as the 4th parameter.

See also
Back to top