Your search did not match any results.
Range Selector

Use Range Selection for Calculation

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. Select the function’s call mode using the "Handle Range Changes" drop-down menu.
Copy to Codepen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { $scope.workingDaysCount = 260; $scope.behavior = { callValueChanged: "onMoving" }; $scope.rangeSelectorOptions = { bindingOptions: { behavior: "behavior" }, margin: { top: 50 }, size: { height: 200 }, scale: { startValue: new Date(2011, 0, 1), endValue: new Date(2011, 11, 31), minorTickInterval: "day", tickInterval: "month", minorTick: { visible: false, }, marker: { visible: false }, label: { format: "MMM" } }, sliderMarker: { format: "dd EEEE" }, title: "Calculate the Working Days Count in a Date Period", onValueChanged: function (e) { var currentDate = new Date(e.value[0]), workingDaysCount = 0; while (currentDate <= e.value[1]) { if(currentDate.getDay() > 0 && currentDate.getDay() < 6) { workingDaysCount++; } currentDate.setDate(currentDate.getDate() + 1); } $scope.workingDaysCount = workingDaysCount.toFixed(); } }; $scope.selectBoxOptions = { bindingOptions: { value: "behavior.callValueChanged" }, dataSource: ["onMoving", "onMovingComplete"], width: 210 }; });
<!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> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/event.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/supplemental.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/unresolved.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/message.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/number.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/currency.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/date.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/16.2.6/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/16.2.6/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" ng-app="DemoApp" ng-controller="DemoController"> <div id="range-selector-demo"> <div dx-range-selector="rangeSelectorOptions"></div> <h2>Working days count: <span>{{workingDaysCount}}</span></h2> <div class="action"> <div class="label">Handle Range Changes:</div> <div id="handle" dx-select-box="selectBoxOptions"></div> </div> </div> </div> </body> </html>
#range-selector-demo { height: 440px; width: 100%; text-align: center; } #handle { display: inline-block; } .action { width: 370px; margin: 0 auto; padding-top: 20px; display: inline-block; } .label { display: inline-block; position: relative; bottom: 11px; }