Your search did not match any results.
Filter Builder

With Data Grid

Documentation

This demo shows how to use a standalone FilterBuilder to filter data in the DataGrid widget. The DataGrid also has an integrated filter builder that can be invoked using the filter panel (see the Filter Panel demo).

Copy to CodePen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { $scope.filterBuilderValue = filter; $scope.dataGridFilter = filter; $scope.filterBuilderOptions = { fields: fields, bindingOptions: { value: "filterBuilderValue" } }; $scope.buttonOptions = { text: "Apply Filter", type: "default", onClick: function() { $scope.dataGridFilter = $scope.filterBuilderValue; }, }; $scope.dataGridOptions = { columns: fields, showBorders: true, dataSource: { store: { type: "odata", fieldTypes: { "Product_Cost": "Decimal", "Product_Sale_Price": "Decimal", "Product_Retail_Price": "Decimal" }, url: "https://js.devexpress.com/Demos/DevAV/odata/Products" }, select: [ "Product_ID", "Product_Name", "Product_Cost", "Product_Sale_Price", "Product_Retail_Price", "Product_Current_Inventory" ] }, bindingOptions: { "filterValue": "dataGridFilter" }, height: 300 }; });
<!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.1.0/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/18.2.7/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/18.2.7/css/dx.light.css" /> <link rel="dx-theme" data-theme="android5.light" href="https://cdn3.devexpress.com/jslib/18.2.7/css/dx.android5.light.css" /> <link rel="dx-theme" data-theme="ios7.default" href="https://cdn3.devexpress.com/jslib/18.2.7/css/dx.ios7.default.css" /> <link rel="dx-theme" data-theme="win10.black" href="https://cdn3.devexpress.com/jslib/18.2.7/css/dx.win10.black.css" /> <link rel="dx-theme" data-theme="win10.white" href="https://cdn3.devexpress.com/jslib/18.2.7/css/dx.win10.white.css" /> <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C\/script%3E'))</script> <script src="https://cdn3.devexpress.com/jslib/18.2.7/js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="data.js"></script> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div class="filter-container"> <div dx-filter-builder="filterBuilderOptions"></div> <div dx-button="buttonOptions"></div> <div class="dx-clearfix"></div> </div> <div dx-data-grid="dataGridOptions"></div> </div> </body> </html>
.filter-container { background-color: rgba(191, 191, 191, 0.15); padding: 5px; width: 500px; margin-bottom: 25px; } .dx-filterbuilder { padding: 10px; } .dx-button { margin: 10px; float: right; } .dx-filterbuilder .dx-numberbox { width: 80px; }
var filter = [ ["Product_Current_Inventory", "<>", 0], "or", [ ["Product_Name", "contains", "HD"], "and", ["Product_Cost", "<", 200] ] ], fields = [ { caption: "ID", width: 50, dataField: "Product_ID", dataType: "number" }, { dataField: "Product_Name", dataType: "string" }, { caption: "Cost", dataField: "Product_Cost", dataType: "number", format: "currency" }, { dataField: "Product_Sale_Price", caption: "Sale Price", dataType: "number", format: "currency" }, { dataField: "Product_Retail_Price", caption: "Retail Price", dataType: "number", format: "currency" }, { dataField: "Product_Current_Inventory", dataType: "number", caption: "Inventory" } ];