Fire onCellDblClick

Hi,

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() ??

Nope, but you can use addEventNow it is mimic the same behavior as dbl-click

It doesn’t work for me.

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

Any idea?

Just be sure that you have provided correct start_date and details_on_create was enabled.

scheduler.config.details_on_create = true; scheduler.addEventNow({ start_date: new Date() })

The above snippet correctly triggers lightbox for me.

Tried, but:

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?

The above code must trigger showLightbox ( at least it do so in my case ) so it will show a custom lightbox in the same was as default one.

Please share a demo link where problem can be checked.

I upload a demo here: dimas.byethost15.com/demo/demo.html

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

I can’t use “onBeforeLightbox” event to make a custom lightbox. I followed the instructions from here: docs.dhtmlx.com/scheduler/custom … _form.html

I simplified the demo, home now it will be more easy to debug: dimas.byethost15.com/demo/demo.html

Have you tried the simplified version? I’m still getting the error :_(

I tried with Chrome and the JS error is a little more dettailed:

Uncaught TypeError: Cannot read property 'pageX' of undefined dhtmlxscheduler.js:2533 Uncaught TypeError: Cannot set property '_dhx_changed' of undefined dhtmlxscheduler_timeline.js:888

As far as I can see - problem occurs because of the next line

scheduler.attachEvent("onEventCreated", function(id,e){ get_context_event(e); });

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.