dhtmlxdhtmlx-scheduler

DHTMLX Scheduler timeline click on day_date


In a scheduler timeline view having a second_scale, is it possible to click on a single date? I have found this answer, but I'm wondering if there is an event in the meantime.

enter image description here


Solution

  • There are onXScaleClick, onXScaleDblClick events for the Timeline view. But in case, when you have 2 scales, they fire only for the second one. Check console in the snippet that demonstrates it.

    Nonetheless, you can add onclick event listener for the first scale using js:

    var dateScaleEl = document.querySelector(".dhx_second_scale_bar");
    dateScaleEl.onclick = function() {
        var targetDate = scheduler.getState().date;
        console.log(targetDate);
    }
    

    Demo.

    getState() is a method to get the active date.