Dynamically updating properties of the week view

Hello,

I want to dynamically change preferences of the scheduler without reloading.

Specifically:

scheduler.config.scroll_hour scheduler.config.start_on_monday

Currently I have attempted a few things like:

[code]function updatePreferences(sch) {
j.ajax({
type: “json”,
url: “/getproperties/” + sch.value,
complete: function (response) {
properties = JSON.parse(response.responseText);//return json array from the server
//Overwrite global variables
mondayStart = properties.monday_start;
scrollHour = properties.scroll_hour;

        scheduler.config.scroll_hour = scrollHour;
        scheduler.config.start_on_monday = mondayStart;
        scheduler.setCurrentView();
        //scheduler.updateView();
    }
});

};[/code]

Unfortunately the view is not refreshing with the new settings.

Thanks,
Tim

Hi,
dinamic modifying of start_on_monday works in a basic examples
You can test it if you open any online examlpe and execute these lines in browser console

scheduler.config.start_on_monday = false; scheduler.setCurrentView();
ANDscheduler.config.start_on_monday = true; scheduler.setCurrentView();
docs.dhtmlx.com/scheduler/sample … _init.html

If it not works in your case - probably this is caused by value you get from AJAX. E.g. if it returns ‘0’ and ‘1’ (string with zero or one), both of them will be equal true when converted to boolean.

scroll_hour probably not works because of preserve_scroll config (it returns vertical scroll to the same level when you refresh the view on scroll to the next/prev days). Disabling this config while you changing the settings fixes the issue:

[code]scheduler.config.preserve_scroll = false;

scheduler.config.scroll_hour = scrollHour1;
scheduler.config.start_on_monday = mondayStart
1;
scheduler.setCurrentView();

scheduler.config.preserve_scroll = true;[/code]

docs.dhtmlx.com/scheduler/api__s … onfig.html

Hello,

Perfect!! You were correct on both occasions!

Thank-you so much.

Tim