Your search did not match any results.
Range Selector

Use Range Selection for Calculation

API Reference
The RangeSelector widget allows you to handle the change of the currently selected range. For this purpose, the RangeSelector's configuration object exposes the "selectedRangeChanged" callback function. Select the function's call mode using the 'Handle Range Changes' option.
Copy to Codepen
Apply
Reset
$(function(){ var rangeSelector =$("#range").dxRangeSelector({ 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" } }, behavior: { callValueChanged: "onMoving" }, 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); } $("#workingDaysCount").html(workingDaysCount.toFixed()); } }).dxRangeSelector("instance"); $("#handle").dxSelectBox({ dataSource: ["onMoving", "onMovingComplete"], width: 210, value: "onMoving", onValueChanged: function (data) { rangeSelector.option("behavior.callValueChanged",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> <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.4/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.4/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/16.2.4/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/16.2.4/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"> <div id="range-selector-demo"> <div id="range"></div> <h2>Working days count: <span id="workingDaysCount">260</span></h2> <div class="action"> <div class="label">Handle Range Changes:</div> <div id="handle"></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; }