Integration with calendar
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Integration with calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
<script src="../../../codebase/dhtmlx.js"></script>
<script>
var myToolbar;
var myCalendar;
var input_from;
var input_till;
function doOnLoad() {
myToolbar = new dhtmlXToolbarObject("toolbarObj");
myToolbar.setIconsPath("../common/imgs/");
myToolbar.addText("text_from", null, "From");
myToolbar.addInput("date_from", null, "", 75);
myToolbar.addText("text_till", null, "Till");
myToolbar.addInput("date_till", null, "", 75);
myToolbar.addButton("button_apply", null, "Apply Filter", "save.gif");
// get inputs
input_from = myToolbar.getInput("date_from");
input_from.setAttribute("readOnly", "true");
input_from.onclick = function(){ setSens(input_till,"max"); }
input_till = myToolbar.getInput("date_till");
input_till.setAttribute("readOnly", "true");
input_till.onclick = function(){ setSens(input_from,"min"); }
// init calendar
myCalendar = new dhtmlXCalendarObject([input_from,input_till]);
myCalendar.setDateFormat("%d.%m.%Y");
myToolbar.setValue("date_from","02.07.2012");
myToolbar.setValue("date_till","13.07.2012");
}
// add logic for selecting range (see the same logic here dhtmlxCalendar/samples/01_init_and_usage/14_set_interval_with_two_inputs.html)
function setSens(inp, k) {
if (k == "min") {
myCalendar.setSensitiveRange(inp.value, null);
} else {
myCalendar.setSensitiveRange(null, inp.value);
}
}
</script>
</head>
<body onload="doOnLoad();">
<div style="height: 500px;"><div id="toolbarObj"></div></div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.