Your search did not match any results.

Pivot Grid - Integrated Field Chooser

The field chooser allows users to manage pivot grid fields. You can configure the field chooser integrated into the PivotGrid or use it as a standalone component. This example demonstrates the integrated field chooser. To open the field chooser window, click the icon in the top-left corner or right-click a row or column header and select Show Field Chooser from the context menu.

Backend API
@(Html.DevExtreme().PivotGrid() .ID("sales") .AllowSortingBySummary(true) .AllowSorting(true) .AllowFiltering(true) .AllowExpandAll(true) .Height(470) .ShowBorders(true) .FieldChooser(fc => fc .AllowSearch(true) .ApplyChangesMode(ApplyChangesMode.Instantly)) .DataSource(d => d .Fields(fields => { fields.Add() .DataField("[Product].[Category]") .Area(PivotGridArea.Row); fields.Add() .DataField("[Product].[Subcategory]") .Area(PivotGridArea.Row) .HeaderFilter(hf => hf.Search(hfs => hfs.Enabled(true))); fields.Add() .DataField("[Ship Date].[Calendar Year]") .Area(PivotGridArea.Column); fields.Add() .DataField("[Ship Date].[Month of Year]") .Area(PivotGridArea.Column); fields.Add() .DataField("[Measures].[Customer Count]") .Area(PivotGridArea.Data); }) .Store(s => s.Xmla() .Url("https://demos.devexpress.com/Services/OLAP/msmdpump.dll") .Catalog("Adventure Works DW Standard Edition") .Cube("Adventure Works") ) ) ) <div class="options"> <div class="caption">Options</div> <div class="option"> <span>Apply Changes Mode:</span> @(Html.DevExtreme().SelectBox() .ID("applyChangesMode") .DataSource(new JS("applyChangesModes")) .InputAttr("aria-label", "Apply Changes Mode") .Width(180) .Value(new JS("applyChangesModes[0]")) .OnValueChanged("selectBox_onValueChanged") ) </div> </div> <script> var applyChangesModes = ["instantly", "onDemand"]; function selectBox_onValueChanged(data) { $("#sales").dxPivotGrid("instance").option("fieldChooser.applyChangesMode", data.value); } </script>
using DevExtreme.NETCore.Demos.Models.SampleData; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; namespace DevExtreme.NETCore.Demos.Controllers { public class PivotGridController : Controller { public ActionResult IntegratedFieldChooser() { return View(); } } }
.options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); margin-top: 20px; } .caption { font-size: 18px; font-weight: 500; } .option { margin-top: 10px; } #applyChangesMode { margin-top: 5px; }

Enable the Integrated Field Chooser

The integrated field chooser is configured in the fieldChooser object. To enable the field chooser, set the object's enabled property to true. This setting adds the Field Chooser icon to the PivotGrid and the Show Field Chooser command to the context menu.

Organize Fields

The field chooser window displays five field sections:

  • Row Fields
  • Column Fields
  • Data Fields
  • Filter Fields
  • All Fields

You can use the fieldChooser.layout property to arrange the sections in different ways.

The All Fields section includes fields declared in the fields[] array and auto-generated fields as shown in this demo. If you want to hide the auto-generated fields, disable the dataSource.retrieveFields property. You can also hide any particular field if you disable its visible property.

You can enable hierarchical display in the All Fields section. Specify the same displayFolder for the fields that should be grouped together. In this demo, the hierarchy is built on the server.

Users can drag and drop fields between the sections. When users move a field to the Row, Column, Data, or Filter Fields section, the PivotGrid adds this field to the corresponding area. To do the same programmatically, specify the field's area property. If a field is intended to be moved to the Data Fields section only, enable the field's isMeasure property, and vice versa: disable the isMeasure property for fields that should never be in the Data Fields section. In this demo, these restrictions are specified on the server.

After a user finishes moving fields between sections, the changes can either be applied immediately or after the user clicks OK. Use the fieldChooser.applyChangesMode property to set the desired mode. In this demo, you can change this property at runtime.

Enable Search

Users can search in the All Fields section if you enable the fieldChooser.allowSearch property as shown in this demo. In addition, you can specify the searchTimeout property to delay the search.