Get calculated task width


is it possible to get the calculated task width so I can apply a certain CSS class on a set width?

I can use this to set the class:

gantt.templates.task_class = function(start, end, task){
  // how to get width of task in pixels?

`I believe this function is called before the task is rendered so I can’t seem to select it and do a width. Is it even possible to get this information at all inside this function?


You can use getTaskPosition method to get the task’s width and other parameters:
Here is an example:


thank you, that did the trick!