Hi,
I am using Gantt v8.0 and facing an issue similar to the one discussed in this post. I have split the horizontal scroll into two parts: one for the grid and one for the timeline. However, when I adjust the grid size, the autofit
function does not work as expected. A space appears between the timeline and the grid, even though the autofit
option is set to true
in my configuration, as shown in the response.
Additionally, when I inspect the gantt
object in the console, the autofit
option appears to be disabled, despite being explicitly configured as true
.
- Is there any way to resolve this issue and make the
autofit
feature work correctly with a split horizontal scroll? - If not, could you guide me on how to capture the resize event and calculate the timeline width? I would like to manually adjust the grid width to address this problem.
Below is the Gantt configuration I am using:
gantt = Gantt.getGanttInstance();
/** config */
gantt.config.show_errors = true;
gantt.config.scale_height = 50;
gantt.config.autofit = true;
gantt.config.columns = [
{ name: "text", label: 'text', tree: true, min_width: 200, resize: true, editor: false },
];
gantt.config.layout = {
css: "gantt_container",
cols: [
{
width: 900,
min_width: 200,
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" }
]
};
gantt.init("ganttArea");
gantt.config.autofit = true;
Thank you for your assistance!