Change x_date

Hi!

I’m trying to change the timeline view accordingly a value from a dropdownlist. Basically what I’m doing is this:

[i] // Day configuration
if (calendarView == “day”) {

        scheduler.matrix.timeline.x_date = "%H:%i";
        scheduler.matrix.timeline.x_step = 1;
        scheduler.matrix.timeline.x_size = 24;
        scheduler.matrix.timeline.x_length = 24;
        scheduler.matrix.timeline.second_scale.x_date = "%l, %d %F %Y";
    }
    
    // Week configuration
    else if (calendarView == "week") {

        scheduler.matrix.timeline.x_date = "%H:%i";
        scheduler.matrix.timeline.x_step = 12;
        scheduler.matrix.timeline.x_size = 14;
        scheduler.matrix.timeline.x_length = 14;
        scheduler.matrix.timeline.second_scale.x_date = "%l, %d %F";
    }
    
    // Month configuration
    else if (calendarView == "month") {

        scheduler.matrix.timeline.x_date = "00 - 24";
        scheduler.matrix.timeline.x_step = 24;
        scheduler.matrix.timeline.x_size = 31;
        scheduler.matrix.timeline.x_length = 31;
        scheduler.matrix.timeline.second_scale.x_date = "%d";
    }

    scheduler.setCurrentView(scheduler._date, "timeline");[/i]

The x_step, x_size and x_lenght properties take efect and change the timeline, but the labels x_date (either on timeline or timeline.second_scale) don’t.

What can I do for them to take effect on the timeline view?

PS: I tried to clear the matrix (scheduler.matrix = {}) and then use the createTimelineView function to do it all over again but it didn’t work…

Got it! =)

[i]
var a = scheduler.matrix.timeline;
scheduler.templates[a.name + “_scale_date”] = scheduler.date.date_to_str(a.x_date || scheduler.config.hour_date);
scheduler.templates[a.name + “_second_scale_date”] = scheduler.date.date_to_str(a.second_scale && a.second_scale.x_date ? a.second_scale.x_date : scheduler.config.hour_date);

    scheduler.setCurrentView(scheduler._date, "timeline");

[/i]

Hello,

You are right. x_date is used to define time format, then in the code we generate function using it and later on use only that function (generating function each time will impact perfomance). Snippet from the original source code:

scheduler.templates[obj.name+"_scale_date"] = scheduler.date.date_to_str(obj.x_date||scheduler.config.hour_date);

Kind regards,
Ilya