How to set absolute width of the task cells?


I want to build a zoom slider which also adjusts the width of the task cells (not the grid columns but the task cells). The only config parameter I found was the min_column_width to adjust the width of the class gantt_task_cell. But how do I set an absolute value for the task cells? Will this also be done with gantt.config.columns? If yes how?




Perhaps you can try to implement it by task_cell_class template to change default css style for cells, but I’m not sure it will work without problem.

I think you need to change the source code to change the way of calculating the width of cells.

Dear Polina,

thank you for the answer! I was already afraid that it will be like in your answer. I will have to check if it makes any sense to change the source code. Setting the css style is not working because the width of the bars are calculated separately so the bars are not matching the cells if I only change the cell css style.

I recognized following behavior with MS Edge 40.15063.0.0 and Firefox 54.0 (so these are the browsers I recently test) with dhtmlxGantt 4.0.10 community and dhtmlxGantt 4.1.19 pro.
With the following settings only the hours are displayed that fit into the data area and when I scroll horizontal the other hours to the left and right are missing. Is that standard behavior or concerned to some kind of misconfiguration?

    gantt.config.scale_unit = "hour";
    gantt.config.date_scale = "%H";
    gantt.config.subscales = [
        {unit:"month", step:1, date:"%F %Y" },
        {unit:"day", step:1, date:"%d" }
    gantt.config.min_column_width = 50;

Please see the screenshot below:


Please, set smart_scales config to false: … onfig.html

Hi Polina,

thank you! Disabling smart scales did the trick.

Best regards!