Your search did not match any results.
Range Selector

Use Range Selection for Calculation

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
$(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=""> <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=""></script> <script src=""></script> <script src=""></script> <script src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="dx-theme" data-theme="generic.light" href="" /> <script src=""></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; }