Your search did not match any results.
RangeSelector

Use Range Selection for Filtering

Documentation
The RangeSelector widget allows you to handle changes of the currently selected range. For this purpose, the callback function is specified in the onValueChanged option. This demo illustrates how to use the newly selected range for filtering data.
Copy to CodePen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { $scope.employees = employees; $scope.rangeSelectorOptions = { margin: { top: 20 }, size: { height: 140 }, dataSource: employees, dataSourceField: "BirthYear", scale: { tickInterval: 1, minorTickInterval: 1 }, behavior: { callValueChanged: "onMoving" }, title: "Filter Employee List by Birth Year", onValueChanged: function (e) { var selectedEmployees = $.grep(employees, function(employee) { return employee.BirthYear >= e.value[0] && employee.BirthYear <= e.value[1]; }); $scope.employees = selectedEmployees; } }; });
<!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.1.4/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.4/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/17.1.4/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.1.4/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 id="range-selector-demo"> <div dx-range-selector="rangeSelectorOptions"></div> <h2>Selected Employees</h2> <table> <tbody> <tr> <td> <b>First Name</b> </td> <td> <b>Last Name</b> </td> <td> <b>Birth Year</b> </td> <td> <b>City</b> </td> <td> <b>Title</b> </td> </tr> <tr ng-repeat="employee in employees"> <td>{{employee.FirstName}}</td> <td>{{employee.LastName}}</td> <td>{{employee.BirthYear}}</td> <td>{{employee.City}}</td> <td>{{employee.Title}}</td> </tr> </tbody> </table> </div> </div> </body> </html>
#range-selector-demo { height: 440px; width: 100%; } h2 { margin-top: 38px; text-align: center; } table { width: 100%; } td { width: 20%; }
var employees = [ { LastName: "Davolio", FirstName: "Nancy", BirthYear: 1948, City: "Seattle", Title: "Sales Representative" }, { LastName: "Fuller", FirstName: "Andrew", BirthYear: 1952, City: "Tacoma", Title: "Vice President, Sales" }, { LastName: "Leverling", FirstName: "Janet", BirthYear: 1963, City: "Kirkland", Title: "Sales Representative" }, { LastName: "Peacock", FirstName: "Margaret", BirthYear: 1937, City: "Redmond", Title: "Sales Representative" }, { LastName: "Buchanan", FirstName: "Steven", BirthYear: 1955, City: "London", Title: "Sales Manager" }, { LastName: "Suyama", FirstName: "Michael", BirthYear: 1963, City: "London", Title: "Sales Representative" }, { LastName: "King", FirstName: "Robert", BirthYear: 1960, City: "London", Title: "Sales Representative" }, { LastName: "Callahan", FirstName: "Laura", BirthYear: 1958, City: "Seattle", Title: "Inside Sales Coordinator" }, { LastName: "Dodsworth", FirstName: "Anne", BirthYear: 1966, City: "London", Title: "Sales Representative" } ];