Get calculated task width


#1

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?


#2

Hello,
You can use getTaskPosition method to get the task’s width and other parameters:
https://docs.dhtmlx.com/gantt/api__gantt_gettaskposition.html
Here is an example:
http://snippet.dhtmlx.com/49d624077


#3

thank you, that did the trick!