а

How to Hide Cell/Column in Gantt Grid


#1

Is there a functionality or function where I can hide a column in the Grid? I see that the Gantt library shows up the previous date by default. For example, in this picture I have tasks starting on Tuesday 19th however Monday 18th column shows up even though no task or data is present in that column.

Any idea on how to do this? I would appreciate it!!

UPDATE
If I use:

gantt.config.start_date = new Date("2019-11-19 00:00:00");
gantt.config.end_date = new Date("2019-11-19 23:59:59");

it works as expected, restricting the view only to that day. However, I only want to restrict the range on the start date. If I do gantt.config.start_date = new Date("2019-11-19 00:00:00"); without doing the configuration for the End Date, the previous day is still showing up.


#2

Hi @chrisjj,
Unfortunately, there is no built-in way to define only gantt.config.start_date and avoid defining gantt.config.end_date, but if I understand you correctly, you want to cut the void column from the scale start and left it on the scale end, am I right?
In order to do this, you can use some custom function, which will set the scale_end date to the end_date of the latest task+some gap(you can set it in a value you want), so you can call this function on some events(like onLightboxSave or some drag events, like “onAfterTaskDrag”) to change the scale_end dynamically.
So you will be able to set fixed scale_start of the scale and dynamic scale_end
Here is a snippet:
http://snippet.dhtmlx.com/464c9f27c

API:
onAfterTaskDrag
https://docs.dhtmlx.com/gantt/api__gantt_onaftertaskdrag_event.html
onLightboxSave
https://docs.dhtmlx.com/gantt/api__gantt_onlightboxsave_event.html