Your search did not match any results.
Range Selector

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 CodeSandBox
Apply
Reset
<template> <div> <dx-range-selector id="range-selector" :data-source="employees" :value.sync="range" title="Filter Employee List by Birth Year" data-source-field="BirthYear" > <dx-margin :top="20"/> <dx-scale :tick-interval="1" :minor-tick-interval="1" > <dx-label> <dx-format type="decimal"/> </dx-label> </dx-scale> <dx-behavior call-value-changed="onMoving"/> </dx-range-selector> <h2 class="grid-header">Selected Employees</h2> <dx-data-grid :data-source="selectedEmployees" :columns="columns" :show-borders="true" :column-auto-width="true" /> </div> </template> <script> import { employees } from './data.js'; import { DxRangeSelector, DxMargin, DxScale, DxLabel, DxFormat, DxBehavior } from 'devextreme-vue/range-selector'; import { DxDataGrid } from 'devextreme-vue/data-grid'; export default { components: { DxDataGrid, DxRangeSelector, DxMargin, DxScale, DxLabel, DxFormat, DxBehavior }, data() { return { employees, range: [], columns: ['FirstName', 'LastName', 'BirthYear', 'City', 'Title'], format: { type: 'decimal' } }; }, computed: { selectedEmployees() { return employees.filter(employee => employee.BirthYear >= this.range[0] && employee.BirthYear <= this.range[1] || !this.range.length); } } }; </script> <style scoped> #range-selector { height: 140px; } h2.grid-header { font-size: 20px; margin: 38px 0 10px; text-align: center; } </style>
import Vue from 'vue'; import App from './App.vue'; new Vue({ el: '#app', components: { App }, template: '<App/>' });
<!DOCTYPE html> <html> <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" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.light.css" /> <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script> <script src="https://unpkg.com/systemjs@0.21.3/dist/system.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('./index.js'); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> </body> </html>
export const 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' } ];
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': 'https://unpkg.com/' }, map: { vue: 'npm:vue@2.6.3/dist/vue.esm.browser.js', 'vue-loader': 'npm:dx-systemjs-vue-browser@latest/index.js', 'devextreme': 'npm:devextreme@19.2', 'devextreme-vue': 'npm:devextreme-vue@19.2', jszip: 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.7/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', 'devexpress-gantt': 'npm:devexpress-gantt', 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js' }, meta: { '*.vue': { loader: 'vue-loader' } }, packages: { 'devextreme-vue': { main: 'index.js' }, 'devextreme': { defaultExtension: 'js' } }, babelOptions: { sourceMaps: false, stage0: true } });