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.

Use the following options to configure the header filter:

  • allowSearch
    Enables a user to search through field values.

  • 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 option is true. If you clear the corresponding checkbox under the widget, the City field displays all cities, regardless of the other applied filters.

@(Html.DevExtreme().PivotGrid() .ID("pivotgrid") .AllowFiltering(true) .AllowSorting(true) .AllowSortingBySummary(true) .Height(570) .ShowBorders(true) .HeaderFilter(h => h .AllowSearch(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].[Customer Count]") .Area(PivotGridArea.Data); fields.Add() .DataField("[Customer].[Country]") .FilterValues(new string[] { "[Customer].[Country].&[United Kingdom]" }) .Area(PivotGridArea.Filter); fields.Add() .DataField("[Ship Date].[Calendar Year]") .FilterValues(new string[] { "[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="option"> @(Html.DevExtreme().CheckBox() .Text("Allow Search") .Value(true) .OnValueChanged(@<text> function(data) { $("#pivotgrid").dxPivotGrid("instance").option("headerFilter.allowSearch", 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>
using DevExtreme.MVC.Demos.Models.SampleData; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace DevExtreme.MVC.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; }