$(function(){
var salesPivotGrid = $("#sales").dxPivotGrid({
allowFiltering: true,
allowSorting: true,
allowSortingBySummary: true,
height: 570,
showBorders: true,
headerFilter: {
allowSearch: 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: "https://demos.devexpress.com/Services/OLAP/msmdpump.dll",
catalog: "Adventure Works DW Standard Edition",
cube: "Adventure Works"
}
}
}).dxPivotGrid("instance");
$("#allow-search").dxCheckBox({
text: "Allow Search",
value: true,
onValueChanged: function(data) {
salesPivotGrid.option("headerFilter.allowSearch", data.value);
}
});
$("#show-relevant-values").dxCheckBox({
text: "Show Relevant Values",
value: true,
onValueChanged: function(data) {
salesPivotGrid.option("headerFilter.showRelevantValues", data.value);
}
});
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<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=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></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="https://cdn3.devexpress.com/jslib/20.2.4/css/dx.common.css" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/20.2.4/css/dx.light.css" />
<script src="https://cdn3.devexpress.com/jslib/20.2.4/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="option">
<div id="allow-search"></div>
</div>
<div class="option">
<div id="show-relevant-values"></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;
}