Timeline templates

Hello
I am trying to set a template for the timeline_scale_label but i don’t understand how it works.
First of all, even by looking in the documentation, I was not sure of what function I should have defined. By looking in the dhtmlxscheduler_timeline.js I found out that it was a function (p,r,q) (3 arguments) that should be defined.
So I set my function as the following :
scheduler.templates.timeline_scale_label = function(Q,R,P) {
return "test : "+R;
}
But it doesn’t go in the function (I put a breakpoint using IE)

I am using a timeline, and I would like to modify the content of the label (Y column) in order to add HTML code to show an image within the label column next to the label that is currently displayed.
I am not sure that it is possible, but as I doesn’t even suceed in the fact to access to the templates :laughing:

Have somebody some hints to help me ?
Thanks in advance !

Hello,

Thank you for your question. It seems this information is missing in the documentation, we will add it the nearest future.
Template may look like this:

scheduler.templates.timeline_scale_label = function(key, label, timeline_config) { return label+" (id: "+key+"); };
Where timeline — is the name of your timeline view, e.g.:

scheduler.createTimelineView({ name: "timeline", ...
Add this template somewhere before scheduler’s init. In case it won’t work - what version of scheduler are you using?
Hope this helps.

Best regards,
Ilya

It doesnt’ work for me. I have tried to put the code before or after the init function with the same result.
An extract from my code :

    scheduler.templates.timeline_scale_label  = function(key,label,timeline_config) {
	   return "test : "+label; 
    };
	
	scheduler.createTimelineView({
                name : "timeline",
                x_unit :	"hour",
				x_date :	"%h:%i",
				x_step :	1,
				x_size :	12,
				x_start :	0,
				x_length :	12,
				y_unit :	{},
				y_property : "ressource",
				render : "bar"
			});	
            [...]		
    scheduler.init('scheduler_here',null,"day");
         [...]

I am using DHtmlxScheduler v2.3

There is an other part of the code where I call again scheduler.createTimelineView. The first call is only to initialize the timeline view, the further call are to load the timeline with the proper ressource.
Here is the function that create the timeline with ressources :

scheduler.createTimelineView({
                name : "timeline",
                x_unit :	"hour",
				x_date :	"%H:%i",
				x_step :	1,
				x_size :	24,
				x_start :	0,
				x_length :	24,
				y_unit :	liste_ress,
				y_property : "ressource",

				render : "bar"
				
			});	

where liste_ress contain the list of ressources.

Thanks for your help.

Hi,

When timeline view is initialized it creates all necessary templates for itself with some default values. That is why after you create timeline view the second time previous template function doesn’t seem to work (it was reassigned).

You have two options here:

  1. Create timeline view only one time.
  2. Redefine template function once again.

Best regards,
Ilya

I have tried to put the template definition after the further call of createTimelineView.
It is working, all is ok for now.

Thanks for you help