-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Resizable
-
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
- Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
Pivot Grid - Summary Display Modes
Summary display modes are post-processing functions that allow you to perform additional calculations on each summary value and take into account neighboring summary values. You can use summary display modes to present pivot data from different angles.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
@using DevExtreme.MVC.Demos.Models
<div class="desc-container">
Right-click (or touch and hold) the "Relative Sales" field
and select an item from the appeared context menu to change the
<b>"summaryDisplayMode"</b> option.
</div>
@(Html.DevExtreme().PivotGrid<Sale>()
.AllowSortingBySummary(true)
.AllowSorting(true)
.AllowExpandAll(true)
.ShowBorders(true)
.FieldChooser(c => c.Enabled(false))
.FieldPanel(p => p.ShowFilterFields(false).AllowFieldDragging(false).Visible(true))
.OnContextMenuPreparing("contextMenu_preparing")
.DataSource(d => d
.Store(s => s.WebApi().Controller("PivotGridData"))
.Fields(fields => {
fields.AddFor(m => m.Region)
.Width(120)
.Area(PivotGridArea.Row);
fields.AddFor(m => m.City)
.Width(150)
.Area(PivotGridArea.Row);
fields.AddFor(m => m.Date)
.Area(PivotGridArea.Column);
fields.Add()
.GroupName("Date")
.GroupInterval(PivotGridGroupInterval.Year)
.Expanded(true);
fields.AddFor(m => m.Amount)
.Caption("Relative Sales")
.SummaryType(SummaryType.Sum)
.Area(PivotGridArea.Data)
.SummaryDisplayMode(PivotGridSummaryDisplayMode.PercentOfColumnGrandTotal);
})
)
)
<script>
var summaryDisplayModes = [
{ text: "None", value: "none" },
{ text: "Absolute Variation", value: "absoluteVariation" },
{ text: "Percent Variation", value: "percentVariation" },
{ text: "Percent of Column Total", value: "percentOfColumnTotal" },
{ text: "Percent of Row Total", value: "percentOfRowTotal" },
{ text: "Percent of Column Grand Total", value: "percentOfColumnGrandTotal" },
{ text: "Percent of Row Grand Total", value: "percentOfRowGrandTotal" },
{ text: "Percent of Grand Total", value: "percentOfGrandTotal" }
];
function contextMenu_preparing(e) {
var dataSource = e.component.getDataSource();
if(e.field && e.field.dataField === "Amount") {
$.each(summaryDisplayModes, function(_, summaryDisplayMode) {
var summaryDisplayModeValue = summaryDisplayMode.value;
e.items.push({
text: summaryDisplayMode.text,
selected: e.field.summaryDisplayMode === summaryDisplayModeValue,
onItemClick: function() {
var format,
caption = summaryDisplayModeValue === "none" ? "Total Sales" : "Relative Sales";
if(summaryDisplayModeValue === "none"
|| summaryDisplayModeValue === "absoluteVariation") {
format = "currency";
}
dataSource.field(e.field.index, {
summaryDisplayMode: summaryDisplayModeValue,
format: format,
caption: caption
});
dataSource.load();
}
});
});
}
}
</script>
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
Apply a Summary Display Mode
DevExtreme PivotGrid supports predefined summary display modes decribed below. To apply one of them, set the summaryDisplayMode property.
-
"absoluteVariation"
Calculates the absolute difference between the current and previous value in a row. Starts from the second value in the row because the first does not have a previous value. -
"percentVariation"
Same as the absolute variation, but the difference is calculated as a percentage. -
"percentOfColumnTotal"
Calculates the current value as a percentage in one of the column's intermediate totals or the column's grand total when there are no expanded rows. -
"percentOfRowTotal"
Calculates the current value as a percentage in one of the row's intermediate totals or the row's grand total when there are no expanded columns. -
"percentOfColumnGrandTotal"
Calculates the current value as a percentage in the column's grand total. -
"percentOfRowGrandTotal"
Calculates the current value as a percentage in the row's grand total. -
"percentOfGrandTotal"
Calculates the current value as a percentage in the grand total of the entire pivot grid.
If the predefined modes do not suit your needs, you can implement a custom post-processing function—calculateSummaryValue. Note that the PivotGrid ignores the summaryDisplayMode property if the calculateSummaryValue function is defined.
Change the Summary Display Mode at Runtime
In this demo, you can switch between predefined summary display modes at runtime. Right-click or long-tap the Relative Sales field in the field panel and select a mode from the invoked context menu.
To implement this functionality in your application, use the onContextMenuPreparing event handler. Within this handler, you should detect the right-clicked field. If it is a target field, change its summaryDisplayMode and optionally other properties, such as caption or format.