Hello,
I’m using version 2.3 on the Scheduler, using c# and asp.net.
In my Page_Load event I’m creating the scheduler, using the following javascript function.
function initScheduler() {
var step = 5;
var format = scheduler.date.date_to_str("%H:%i");
scheduler.config.xml_date = "%Y-%m-%d %H:%i";
scheduler.config.show_loading = true;
scheduler.config.dblclick_create = true;
scheduler.config.start_on_monday = true;
scheduler.xy.scale_height = 20;
//scheduler.config.hour_size_px=240;
scheduler.config.hour_size_px = (60 / step) * 21;
scheduler.templates.hour_scale = function (date) {
html = "";
for (var i = 0; i < 60 / step; i++) {
html += "<div style='height:21px;line-height:21px;'>" + format(date) + "</div>";
date = scheduler.date.add(date, step, "minute");
}
return html;
}
scheduler.config.time_step = 5;
scheduler.config.first_hour = 9;
scheduler.config.last_hour = 19;
scheduler.config.details_on_dblclick = true;
scheduler.config.drag_resize = false;
scheduler.config.drag_create = false;
scheduler.config.details_on_create = true;
scheduler.config.edit_on_create = true;
scheduler.config.icons_edit = ['icon_delete'];
scheduler.config.icons_select = ['icon_delete'];
scheduler.locale.labels.unit_tab = "Units"
scheduler.locale.labels.section_custom = "Units";
scheduler.config.xml_date = "%Y-%m-%d %H:%i";
scheduler.templates.event_class = function (start, end, event) {
return "s_" + event.servizio;
}
scheduler.config.multi_day = true;
scheduler.attachEvent("onDblClick", function (event_id, native_event_object) {
doShowEvent(event_id);
return false;
});
scheduler.attachEvent("onBeforeEventDelete", function (event_id, evt) {
doDeleteEvent(event_id);
return true;
});
scheduler.attachEvent("onEventChanged", function (event_id, event_object) {
doMoveEvent(event_id, JSON.stringify(event_object));
});
scheduler.init('scheduler_here', null, "day");
}
It all works pretty much as I expected, but when I double click an event, it seems the onDblClick gets fired multiple times… It seems executing the above initialization function on Page_Load keeps adding event handlers instead of replacing the existing ones… The first time Page_Load is executed only one event is fired, the second times I get two consecutive dblClick events and so on.
What am I doing wrong?
What’s the best way to initialize the scheduler in an Asp.Net application?
TIA.
Fabio