Change Timeline Sections Dynamically


I need to change timeline sections dynamically.

I have done lots of research and found forum threads asking the same thing. Unfortunately the solutions given in those threads are not working for me.

This is my function that I call with a html select menu.

function changeSchedule(sch) {
                    type: "json",
                    url: "/schedule/getresources/" + sch.value,
                    complete: function (response) {
                        var sections = JSON.parse(response.responseText);//return json array from the server
                        //update named collection
                        scheduler.updateCollection("sections", sections);


I can see the function is evaluated, but no change happens on the scheduler.

My timeline view is generated like:

scheduler.createTimelineView({ name: "timeline_week", x_unit: "day", x_date: "%D %d", x_step: 1, x_size: 7, x_length: 7, y_unit: sections, y_property: "sections", render:"bar" });

I simplified the JSON to the following, however still no results or errors are thrown.

[{"label": "Some Room", "key": "1"}, {"label": "Another Room", "key": "2"}]

However still nothing is happening.

I think there is a problem with the way the JSON is being parsed, but I am not advanced enough in Javascript to be able to identify the correct format.

This is the output I see in the console.

Thank-you for your assistance.


you need to create a serverList “sections” and link it to a “y_unit” property of the timeline when initializing the scheduler:

scheduler.createTimelineView({ name: "timeline_week", ... y_unit: scheduler.serverList("sections"), ... });

Hi Serge,

Thank-you very much for your reply.

I am now seeing the sections on the timeline, but not in the heirachy I am expecting.

My JSON output is:

[ { "key" : "1", "label" : "Room 1" }, { "key" : "2", "label" : "Room 2" }, { "key" : "3", "label" : "Room 3" }, { "key" : "5", "label" : "Cameras", "children" : [ { "key" : "4", "label" : "Something" }, { "key" : "6", "label" : "Another Camera" } ] } ]

Only the parents are shown, not the children.

Does serverList support the normal output of heirachial structure?


Hi Serge,

Sorry, please disregard my previous post. I did not have the treetimeline.js library properly loaded.

Unfortunately, I have one more question.

How can I set the scheduler to load the sections from the server on initialization?


I have another question in addition to the one I posted below.

I need to customise the labels of the timeline “scale labels”. ( … plate.html). Unfortunately this is not working when I load in the timeline sections in the method you outlined below.

Hope you can help.

it’s quite strange because the “scale_label” template is called for every section when timeline is rendered. So when you have a “hardcoded” array with the list of sections (not “scheduler.serverList”) it works good ?

Hi Serge,

Yes I have tested again and the template render’s successfully when I use a “hardcoded” array with the list of sections. When I call updateCollection (using the custom function changeSchedule shown above) and retrieve the sections via “Scheduler.serverList” the template is not used.

Hi Serge,

Do you have any ideas that I could try? This feature is important for me because I want to customise the labels for the sections in the timeline view. Perhaps you have some alternative suggestions?


Can anyone else offer any solutions on how I can work around this? By the sounds of it, this is a bug with the scheduler… How can I lodge a bug report?