In the agenda view, it is impossible to trigger events: click, dblclick, etc.
I have tried creating javascript that has .dhx_agenda_line’s click trigger .dhx_cal_data’s click event - but it never gets back to the scheduler’s event handler.
What’s the workaround? I noticed that in the agenda week view it is not a problem, but there is a lot of complex javascript and I didn’t dig deeply enough to see what the difference is.
Do you mean clicking on free space of agenda view? Because event handlers definitely works for the event bars in the agenda view.
Clicking on empty space currently doesn’t produce events in many view ( we are thinking about fixing this situation ), you can locate the next line in scheduler.js
if ((id && !scheduler.callEvent(“onClick”,[id,e])) ||scheduler.config.readonly) return;
and change it as
if ((!scheduler.callEvent(“onClick”,[id,e])) ||scheduler.config.readonly) return;
Thanks. That helps a little. What I really want to do is match the behavior I have on other views:
Dblclick handler when clicking on event text
Use scheduler.templates.event_class in order to color-code events.
Override what is displayed in agenda view using the templates extension, or some other way.
Basically, I’d like the agenda view to support all the same features that other views have for consistency of the user experience. I found that tooltips do work correctly. The items above are what remains.
dblclick - confirmed and will be fixed in the next version ( file in the attached sample already contains the fix )
class and text already can be customized through templates - check the attached sample. scheduler_agenda.zip (52.6 KB)
I discovered that the fix provided here doesn’t fix the issue if a class name is used for display of agenda text:
scheduler.templates.agenda_text = function(s,e,t){
return '<div class="foo">' + t.text + '</div>';
} //dbl-click does not work
scheduler.templates.agenda_text = function(s,e,t){
return '<div class="">' + t.text + '</div>'; //empty class or no class
} //dbl-click works!
Problem confirmed, fix will be provided as part of oncoming update.
Please send PM if you need it ASAP ( I will send beta version when it will be available )
You can update scheduler._on_dbl_click function in dthmlxscheduler.js, it should fix the problem:
scheduler._on_dbl_click=function(e,src){
src = src||(e.target||e.srcElement);
if (this.config.readonly) return;
var name = src.className.split(" ")[0];
switch(name){
case "dhx_scale_holder":
case "dhx_scale_holder_now":
case "dhx_month_body":
case "dhx_wa_day_data":
if (!scheduler.config.dblclick_create) break;
this.addEventNow(this.getActionData(e).date,null,e);
break;
case "dhx_body":
case "dhx_wa_ev_body":
case "dhx_agenda_line":
case "dhx_cal_event_line":
case "dhx_cal_event_clear":
var id = this._locate_event(src);
if (!this.callEvent("onDblClick",[id,e])) return;
if (this.config.details_on_dblclick || this._table_view || !this.getEvent(id)._timed)
this.showLightbox(id);
else
this.edit(id);
break;
default:
var t = this["dblclick_"+name];
if (t) {
t.call(this,e);
}
else {
if (src.parentNode)
return scheduler._on_dbl_click(e,src.parentNode);
}
break;
}
};
Kind regards,
Ilya