Search code examples
schedulerdhtmlx

DHTMLX Scheduler - Calendar view - set focus to config.mark_now


When loading the calendar, I have divided the hours into intervals of 30 mins each.

This is my initial configuration.

    scheduler.locale.labels.unit_tab = "Resources";
    scheduler.config.hour_date = "%h:%i %A";
    scheduler.config.hour_size_px = 88;
    scheduler.config.mark_now = true;
    scheduler.locale.labels.section_custom = "Assigned to";
    scheduler.config.separate_short_events = true;
    scheduler.config.drag_move = false;
    scheduler.config.drag_resize = false;

Due to the 30 mins, my calendar has a scroll bar. The default calendar shows only about 6.5 hrs. So if the current time is 3 PM, the mark_now line is off the view. How do I set focus to the current time and have the current time or mark_now be in the horizontal center of the display?

I am learning dhtmlx and may not be able to answer all queries so would appreciate any guidance. Thanks in advance!


Solution

  • You can add something like next

    scheduler.config.scroll_hour = (new Date).getHours();
    

    It will configure scheduler to scroll day or week view to the current hour.