Your search did not match any results.

Pivot Grid - Header Filter

A header filter allows a user to filter field values by including or excluding them from the applied filter. Click a header filter icon in the field chooser or on the field panel to open a popup menu that displays all unique field values. To display header filter icons, enable the allowFiltering property.

Backend API
@(Html.DevExtreme().PivotGrid() .ID("pivotgrid") .AllowFiltering(true) .AllowSorting(true) .AllowSortingBySummary(true) .Height(570) .ShowBorders(true) .HeaderFilter(hf => hf .Search(hfs => hfs.Enabled(true)) .ShowRelevantValues(true) .Width(300) .Height(400) ) .FieldChooser(f => f.AllowSearch(true)) .FieldPanel(f => f.Visible(true)) .DataSource(d => d .Fields(fields => { fields.Add() .DataField("[Product].[Category]") .Area(PivotGridArea.Column); fields.Add() .DataField("[Product].[Subcategory]") .Area(PivotGridArea.Column); fields.Add() .DataField("[Customer].[City]") .Area(PivotGridArea.Row); fields.Add() .DataField("[Measures].[Internet Total Product Cost]") .Format(Format.Currency) .Area(PivotGridArea.Data); fields.Add() .DataField("[Customer].[Country]") .FilterValues(new[] { "[Customer].[Country].&[United Kingdom]" }) .Area(PivotGridArea.Filter); fields.Add() .DataField("[Ship Date].[Calendar Year]") .FilterValues(new[] { "[Ship Date].[Calendar Year].&[2004]" }) .Area(PivotGridArea.Filter); }) .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="options-container"> <div class="option"> @(Html.DevExtreme().CheckBox() .Text("Allow Search") .Value(true) .OnValueChanged(@<text> function(data) { $("#pivotgrid").dxPivotGrid("instance").option("headerFilter.search.enabled", data.value); } </text>) ) </div> <div class="option"> @(Html.DevExtreme().CheckBox() .Text("Show Relevant Values") .Value(true) .OnValueChanged(@<text> function(data) { $("#pivotgrid").dxPivotGrid("instance").option("headerFilter.showRelevantValues", data.value); } </text>) ) </div> </div> </div>
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 HeaderFilter() { return View(); } } }
#sales { max-height: 570px; } .options { padding: 20px; margin-top: 20px; background-color: rgba(191, 191, 191, 0.15); } .caption { font-size: 18px; font-weight: 500; } .option { width: 24%; display: inline-block; margin-top: 10px; } .options-container { display: flex; align-items: center; }

To configure a header filter, use the global headerFilter object or a field's headerFilter object. This demo specifies the following properties in the global headerFilter object:

  • search
    Allows you to configure a search panel within a header filter.

  • showRelevantValues
    Specifies whether to show all field values or only those that satisfy the other applied filters.

  • width and height
    Configures the popup menu size.

In this demo, a filter is applied to the Country field. This filter includes only the United Kingdom. The City field displays only cities in this country because the showRelevantValues property is true. If you clear the corresponding check box under the PivotGrid, the City field displays all cities, regardless of the other applied filters.