Change Options on Timeline

Hello -

I am trying to manipulate a list of Options that I receive from a datasource before displaying them on a timeline (in order to add parent sections such as departments, which aren’t evident from the database).

I’ve tried it a few different approaches, and I can’t seem to get it to work properly.

This is generally what I’m trying to do:


scheduler.attachEvent("beforeRender", function (){
	//get resources from connector
	server_resources = scheduler.serverList ("resource");
	
	//manipulate the list, in this case grouping everything under one department
	combined_resources = [{key:"Production Dept",label:"Production Dept", children:server_resources}];
	
	//update the information for the timeline
	scheduler.updateCollection("resource",combined_resources);
});


//create timeline

	scheduler.createTimelineView({
		name: "timeline",
		dx: 100, //width of section names
		x_unit: "day",
		x_date: "<span class=hover><a jump_to='%j-%m-%Y 00:00' href='#'>%l, %j %M</a></span>",
		x_step:1,
		x_size:7,
		x_start: 0,
		x_length: 7,
		y_unit: scheduler.serverList ("resource"),
		y_property:"unit",
		render: "bar",
		event_dy:"full",
		resize_events:true,
	});

	scheduler.date.timeline_start = scheduler.date.week_start;

The result of this code is that the list remains the same, without the department being shown.

Thank you.

Hi,
scheduler do not have ‘beforeRender’ event, try onXLE or onOptionsLoad event (note that onOptionsLoad can be also triggered by scheduler.updateCollection)

[code]scheduler.attachEvent(“onXLE”, function (){
//get resources from connector
var server_resources = scheduler.serverList (“resource”).slice();//.slice to make a copy of collection, instead of getting a link

//manipulate the list, in this case grouping everything under one department
var combined_resources = [{key:“Production Dept”,label:“Production Dept”, children:server_resources}];

//update the information for the timeline
scheduler.updateCollection(“resource”,combined_resources);
});[/code]

Not only did that do that trick, but I was messing myself up - in all the copying & pasting, I forgot to change timeline render to “table”. Ugh!

Thanks