Horizontal Scroll question

gantt.config.layout = {
css: “gantt_container”,
cols: [
{
width:400,
min_width: 300,
rows:[
{view: “grid”, scrollX: “gridScroll”, scrollable: true, scrollY: “scrollVer”},
{view: “scrollbar”, id: “gridScroll”, group:“horizontal”}
]
},
{resizer: true, width: 1},
{
rows:[
{view: “timeline”, scrollX: “scrollHor”, scrollY: “scrollVer”},
{view: “scrollbar”, id: “scrollHor”, group:“horizontal”}
]
},
{view: “scrollbar”, id: “scrollVer”}
]
};

Hello. Please.
Horizontal scroll was applied to the source.

After applying horizontal scroll, the timeline expands on button click and is there any way to turn the chart on and off?

Hello Seungmin,
You need to switch between layouts(with and without the timeline) and reinitialize Gantt.
To expand the grid, you need to comment the width parameter in the layout configuration
The following snippet demonstrates how it works:
https://snippet.dhtmlx.com/omk98l0x?text=gantt.%2Btoggle%2Bgrid

Thank you.
But can I turn the chart on or off with horizontal scrolling applied from the beginning?

Hello Seungmin,
Yes, you can switch to any layout configuration.
However, if you have the rows[columns] layout configuration and you switch to the grid view, the grid is expanded. But when you switch back, the grid is not shrunk, you need to manually resize it:
http://snippet.dhtmlx.com/5/dae313ff9
The dev team will fix that issue in the future, but I cannot give you any ETA.

As a workaround, you can change the grid_width parameter after a timeout and repaint the chart:
http://snippet.dhtmlx.com/5/003645d0f

Hello Seungmin,
The dev team fixed the bug with the Gantt container resize. Now, the vertical scrollbar should be visible even when the grid doesn’t fit the Gantt container width:
https://docs.dhtmlx.com/gantt/whatsnew.html#716
You can see that the bug is no longer reproduced in the following sample:
https://snippet.dhtmlx.com/5/4fde31b1d