x_date not updated at updateView()

Hi all,

I’m creating a zoom option for scheduler timeline, and when i update x_date, it just wont change.

if (mode == ‘in’) {
scheduler.matrix[“timeline”].x_unit = “day”;
scheduler.matrix[“timeline”].x_date = “%D”;
scheduler.matrix[“timeline”].x_step = 1;
}

scheduler.updateView();

Date format stays at the default which “%H:%i”. All the other changes take effect! What is wrong with my code?

Thanks for your kind help!

Hello,
scheduler generates a template functions from a x_date value after initialization, so modifying a config value won’t have effect. You’ll have to redefine a template function function
docs.dhtmlx.com/scheduler/api__s … plate.html

Also, note that a preferable way for emulating a zoom functionality is to define a several timelines with different scale units and steps and dinamically switching them. I.e. you define a separate timeline for each zoom level and change the active one when it’s switched. That approach can allow manage zoom easier and can simplify the code

Thank you for your help! made my day!