summary
Optional. Creates the list of calculated values based on the column's data
Usage
summary?: {
[key: string]: string | [string, string] | (row: IRow[]) => string | number
} | string;
Parameters
The defined list of calculated values is available only at the column's level. Can be initialized either as an object or as a string. As an object it contains calculated values set as key:value pairs, where the keys are the field names and values can be:
- a string with the name of the applied functor
- a tuple
[string, string]
that specifies the field name and the name of the applied functor - a
(rows: IRow[]) => string | number;
function for calculating the summary of the column
info
Note that when the column summary
property is initialized as a string, the resulting value (excluding "count") is used with applied patternMask/numberMask
, if there are any.
Example
const grid = new dhx.Grid("grid_container", {
columns: [
{
id: "quantity",
type: "number",
header: [{ text: "Quantity" }],
footer: [{ text: ({ sum }) => sum }],
summary: "sum",
numberMask: { prefix: "$" },
},
// more columns configuration objects
],
// more options
});
Related article: Custom statistics in the column header/footer and spans