DevExtreme v24.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

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
$(() => { const salesPivotGrid = $('#sales').dxPivotGrid({ allowFiltering: true, allowSorting: true, allowSortingBySummary: true, height: 570, showBorders: true, headerFilter: { search: { enabled: true, }, showRelevantValues: true, width: 300, height: 400, }, fieldChooser: { allowSearch: true, }, fieldPanel: { visible: true, }, dataSource: { fields: [ { dataField: '[Product].[Category]', area: 'column' }, { dataField: '[Product].[Subcategory]', area: 'column' }, { dataField: '[Customer].[City]', area: 'row' }, { dataField: '[Measures].[Internet Total Product Cost]', area: 'data', format: 'currency' }, { dataField: '[Customer].[Country]', area: 'filter', filterValues: ['[Customer].[Country].&[United Kingdom]'], }, { dataField: '[Ship Date].[Calendar Year]', area: 'filter', filterValues: ['[Ship Date].[Calendar Year].&[2004]'], }, ], store: { type: 'xmla', url: '', catalog: 'Adventure Works DW Standard Edition', cube: 'Adventure Works', }, }, }).dxPivotGrid('instance'); $('#allow-search').dxCheckBox({ text: 'Allow Search', value: true, onValueChanged(data) { salesPivotGrid.option('', data.value); }, }); $('#show-relevant-values').dxCheckBox({ text: 'Show Relevant Values', value: true, onValueChanged(data) { salesPivotGrid.option('headerFilter.showRelevantValues', data.value); }, }); });
<!DOCTYPE html> <html xmlns="" lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <script src=""></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="" /> <script src="js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="sales"></div> <div class="options"> <div class="caption">Options</div> <div class="options-container"> <div class="option"> <div id="allow-search"></div> </div> <div class="option"> <div id="show-relevant-values"></div> </div> </div> </div> </div> </body> </html>
#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.