Add event from Year view

Hello,

I’ve upgraded Scheduler to the newest version, 4.4.0.
But after doing this, it seems than I cannot add an event from the Year view when I doubleClick on a day. Also, the showLightBox custom function is not being called.

I have a console error:

Uncaught TypeError: Cannot read property ‘match’ of null
at Object.eval (eval at str_to_date (dhtmlxscheduler.js:4184), :3:37)
at Object.e.dblclick_dhx_month_head (dhtmlxscheduler_year_view.js:34)
at Object.scheduler._on_dbl_click (dhtmlxscheduler.js:2345)
at HTMLDivElement._obj.ondblclick (dhtmlxscheduler.js:2160)

In 4.2.0 version this is working fine.

Thank you! :slight_smile:

Hi,
we’ve confirmed a bug. As a solution, please add this code somewhere after dhtmlxscheduler_year_view.js:

[code] scheduler.dblclick_dhx_month_head = function(e) {
if (scheduler.getState().mode == “year”) {
var t = (e.target || e.srcElement);
var className = scheduler._getClassName(t.parentNode);
if (className.indexOf(“dhx_before”) != -1 || className.indexOf(“dhx_after”) != -1) return false;

		var monthNode = t;
		while(monthNode && !(monthNode.hasAttribute && monthNode.hasAttribute("date"))){
			monthNode = monthNode.parentNode;
		}

		if(monthNode){
			var start = this.templates.xml_date(monthNode.getAttribute("date"));
			start.setDate(parseInt(t.innerHTML, 10));
			var end = this.date.add(start, 1, "day");
			if (!this.config.readonly && this.config.dblclick_create)
				this.addEventNow(start.valueOf(), end.valueOf(), e);
		}
	}
};[/code]

It will be included in the next update

Hello,

Thank you for your reply.

I integrated the code in the JS file but it doesn’t seem to work. I have the following error:

Uncaught TypeError: Cannot read property ‘match’ of null
at Object.eval (eval at str_to_date (dhtmlxscheduler.js:4184), :3:37)
at Object.e.dblclick_dhx_month_head (dhtmlxscheduler_year_view.js:34)
at Object.scheduler._on_dbl_click (dhtmlxscheduler.js:2345)
at HTMLDivElement._obj.ondblclick (dhtmlxscheduler.js:

(dhtmlxscheduler_year_view.js:34) - this is exactly after return false

  1. if (className.indexOf(“dhx_before”) != -1 || className.indexOf(“dhx_after”) != -1) return false;
  2. var monthNode = t;

Hi,
everything seems working as expected if I execute that code snippet in browser console in year view demo - docs.dhtmlx.com/scheduler/sampl … _view.html

Can you send me your version of dhtmlxscheduler_year_view.js ?