Click handler on event custom rendering image


I’ve trouble with the following: my events in timeline view are rendered by custom html code: image at top and some text etc below. Clicking on the image only should show a dhtmlx menu in a popup.

While attaching a click handler to an event works through “scheduler.attachEvent(‘click’…)” I am looking to attach a click event handler that would only react to click the specific image (clicking the top area is acceptable too).

I played with attaching event handler to images found in DOM when view changes (from main view to timeline view) but I see that refreshing events looses the event handler. I previously tested with inline click handler, it was OK for Chrome and FF but didn’t work for IE11, maybe I have a layers issue.

There is no event I could rely on looking at … vents.html since I let the events draw themselves by passing JSON to scheduler and asking him to parse… then I have event custom rendering in dedicated functions.

Thanks for any idea,


Structure of my html rendering:

  • event div
    – div with background color that occupies all event div for rendering.
    — span
    ---- right floating span
    ----- image
    – left floating div with text
    – several left or right floating divs with calculated widths and colors (height: 100%).

I solved my issue by changing mind and delimiting the clickable area onto the event main div, since the clickable element has known size at top right corner. Funny ? :wink:

But I confirm that with IE11 the event div was handling the click and not the sub-element image.

scheduler onClick provides DOM event object as a second argument.
So in order to add custom processing for click on specific elements inside event bars, you need to inspect event target inside the handler, and if you detect that it’s a clickable image - run your code … event.html

Thanks, it’s very wise to keep things simple. Indeed with logging I see different objects clicked, in my case not the image but another div (testing with Chrome). Anyways I should have read documentation better :wink: