Timeline cell class function not called

I’m using the cell_class function to set up some custom CSS, but my cell class function is not getting called. My timeline view gets displayed, but the custom css class has not been added to it.

If I strip my system right back to basics and get rid of all my custom configuration options, it works, so I know that it is something that I have done wrong at my end.

scheduler.templates.location_cell_class = function(evs,x,y){ return "custom_css_class"; }

scheduler.createTimelineView({ name: "location", section_autoheight: false, dx:100, dy:25, x_unit: "day", x_date: "%d", x_step: 1, x_size: 21, x_length: 14, y_unit:[ { key: 0, label: "" },{ key: 1, label: "USA" },{ key: 2, label: "UK" },{ key: 3, label: "Australia" } ], y_property:"locationid", render: "bar", second_scale:{ x_unit: "month", x_date: "%F" } });

As you can see from the above snippets, when I create the timeline view I use

name: “location”,

and I create the related function via

location_cell_class

There shouldn’t be anything else neccessary in order to get the

custom_css_class

applied to the cells on the timeline view ?

Is there any config option that I could have set that would stop the scheduler.templates.location_cell_class function getting called?

I’ve got custom css classes being applied successfully in day, week and month views in my main system, and I can get custom css classes working in timeline views in a test system sepearate from my main system, so I know it’s something I have done wrong, or configured incorrectly - I just haven’t figured out what it is yet.

If there’s nothing obvious that you can suggest to me, I’ll just have to strip my whole system down line by line until I figure out what I have done wrong.

SOLVED

In case it helps anyone else, the problem was due to the placement of the scheduler.templates.location_cell_class definition in my code.

I had scheduler.templates.location_cell_class coming BEFORE scheduler.createTimelineView and the function never got called.

Once I placed scheduler.templates.location_cell_class AFTER scheduler.createTimelineView in my code, then everything worked as expected and my custom css class was correctly applied.

1 Like

This is as pertinent in 2022 as it was in 2013!

Hello,

Firstly, you need to create the timeline view by createTimelineView method and only after creation of the timeline, you can use its templates, such as timeline_cell_class template. It’s an expected behavior in the Scheduler.
Please check the following example:
DHTMLX Snippet Tool ;