Your search did not match any results.
DataGrid

Filtering API

Documentation

The DataGrid widget ships with an integrated filtering API, allowing you apply filters in code. In this example, the grid’s filter function is called to filter data based on selections made within the drop-down menu above the DataGrid.

Copy to CodePen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { $scope.gridOptions = { dataSource: { store: { type: "odata", url: "https://js.devexpress.com/Demos/DevAV/odata/Tasks" }, expand: "ResponsibleEmployee", select: [ "Task_ID", "Task_Subject", "Task_Start_Date", "Task_Due_Date", "Task_Status", "Task_Priority", "ResponsibleEmployee/Employee_Full_Name" ] }, columnAutoWidth: true, columns: [ { dataField: "Task_ID" }, { caption: "Start Date", dataField: "Task_Start_Date", dataType: "date" }, { caption: "Assigned To", dataField: "ResponsibleEmployee.Employee_Full_Name", cssClass: "employee", allowSorting: false }, { caption: "Subject", dataField: "Task_Subject" }, { caption: "Status", dataField: "Task_Status" } ] }; $scope.selectStatusOptions = { dataSource: statuses, value: statuses[0], onValueChanged: function(data) { if (data.value == "All") $("#gridContainer") .dxDataGrid("instance") .clearFilter(); else $("#gridContainer") .dxDataGrid("instance") .filter(["Task_Status", "=", 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="js/jquery-3.1.0.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.2.3/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.2.3/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/17.2.3/css/dx.light.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/17.2.3/js/dx.all.js"></script> <script src="data.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" ng-app="DemoApp" ng-controller="DemoController"> <div class="left-side"> <div class="logo"> <img src="images/logo-devav.png" /> <img src="images/logo-tasks.png" /> </div> </div> <div class="right-side"> <div dx-select-box="selectStatusOptions"></div> </div> <div id="gridContainer" dx-data-grid="gridOptions"></div> </div> </body> </html>
.right-side { position: absolute; right: 1px; top: 6px; } .logo { line-height: 48px; } .logo img { vertical-align: middle; margin: 0 5px; } .dx-row.dx-data-row .employee { color: #bf4e6a; font-weight: bold; } #gridContainer { margin: 20px 0; height: 400px; }
var statuses = ["All", "Not Started", "In Progress", "Need Assistance", "Deferred", "Completed"];