I’d like to emulate the onCellDblClick event when the user clicks to an item of the context menu (Right click > Create event). So, when click this item I’d like to emulate the creation of a new event like it happens when the user dblClick on an empty space of the timeline.
Is there something like scheduler._on_dbl_click() ??
The “scheduler.attachEvent(“onContextMenu”, function(event_id_loc, native_event_object)” save the native_event_object into a global variable.
native_ev = native_event_object;
The context menu option “Add event” code:
[code]var actionData = scheduler.getActionData(native_ev);
var bdate = actionData.date;
var bsection = scheduler.getSection(actionData.section);
ev_id = scheduler.addEventNow({
start_date: new Date(cb_date),
end_date: new Date(Date(cb_date) + 1),
text: “temp”,
necessitatId: bsection.key
});
scheduler.showLightbox(ev_id);[/code]
After click the “Add event” option a custom lightbox must appear, but it doesn’t and these javascript errors appear:
TypeError: e is undefined dhtmlxscheduler.js:73
TypeError: this._drag_event is undefined dhtmlxscheduler_timeline.js:32
TypeError: e is undefined dhtmlxscheduler.js:73
TypeError: this._drag_event is undefined dhtmlxscheduler_timeline.js:32
Note that I’m using a custom lightbox:
scheduler.showLightbox = function(id){
ev = scheduler.getEvent(id);
(...)
scheduler.startLightbox(id, planificador);
(...)
}
But showLightbox is not triggered.
With double click it works like a charm. Is there not a simple way to trigger the double click?
It can contain some bugs because is a simplified version without server queries, but it shows the error I have with the “New event” option from the contextual menu.
Hi,
on the page I see the problem with “addEventNow()” method in general not depending on the contextual menu. It’s hard to debug the hole project, please try to isolate the problem excluding all unnecessary scripts and methods. And btw, try to avoid re-writing of the public “showLightbox()” method, you can use “onBeforeLightbox” event instead. docs.dhtmlx.com/scheduler/api__s … event.html
it works fine for events created in normal way, but when you are creating event by API there will be not native event, so “e” in above code will be undefined, which will lead to the error.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan