How to make onmouse over on DHTMLX event calendar? -
i have integrated dhtmlx event calendar java project. want show event details on mouseover event. have tried calling dhtmlxscheduler_tooltip.js
it's not working.
scheduler.attachevent("onmousemove", function(event_id, e){ // (scheduler event_id, browser event) var ev = e||window.event; var target = ev.target||ev.srcelement; if (event_id || dhtmlxtooltip.istooltip(target)) { // if on event or tooltip var event = scheduler.getevent(event_id) || scheduler.getevent(dhtmlxtooltip.tooltip.event_id); dhtmlxtooltip.tooltip.event_id = event.id; var text = scheduler.templates.tooltip_text(event.start_date, event.end_date, event); if (_isie) { //make copy of event, used in timed call var evt = document.createeventobject(ev); } dhtmlxtooltip.delay(dhtmlxtooltip.show, dhtmlxtooltip, [evt||ev, text]); // showing tooltip } else { dhtmlxtooltip.delay(dhtmlxtooltip.hide, dhtmlxtooltip, []); } }); /* redifined */ scheduler.templates.tooltip_date_format=scheduler.date.date_to_str("%y-%m-%d %h:%i"); scheduler.templates.tooltip_text = function(start,end,event) { return "<b>event:</b> "+event.text+"<br/><b>start date:</b> "+scheduler.templates.tooltip_date_format(start)+"<br/><b>end date:</b> "+scheduler.templates.tooltip_date_format(end); };
adding ext/dhtmlxscheduler_tooltip.js extension page after dhtmlxscheudler.js should enough display tooltips on events. check snippet:
scheduler.config.xml_date = "%y-%m-%d %h:%i"; scheduler.templates.tooltip_text = function(start, end, event) { return "<b>event:</b> " + event.text + "<br/><b>start date:</b> " + scheduler.templates.tooltip_date_format(start) + "<br/><b>end date:</b> " + scheduler.templates.tooltip_date_format(end); }; scheduler.init('scheduler_here', new date(2017, 3, 3), "week"); scheduler.parse([ { start_date: "2017-04-03 01:00", end_date: "2017-04-03 18:00", text: "task a-12458" }, { start_date: "2017-04-04 01:00", end_date: "2017-04-04 12:00", text: "task a-89411" } ], "json");
<script src="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler.js"></script> <script src="https://cdn.dhtmlx.com/scheduler/edge/ext/dhtmlxscheduler_tooltip.js"></script> <link rel="stylesheet" href="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler.css"> <div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100vh;'> <div class="dhx_cal_navline"> <div class="dhx_cal_prev_button"> </div> <div class="dhx_cal_next_button"> </div> <div class="dhx_cal_today_button"></div> <div class="dhx_cal_date"></div> <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div> <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div> <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div> </div> <div class="dhx_cal_header"> </div> <div class="dhx_cal_data"> </div> </div>
Comments
Post a Comment