Hello @Mokgadi_Mabapa,
Thanks for the details.
There’s currently no way to keep a large number of tasks all rendered at once and stay fast. Operations like expanding/collapsing branches, resizing columns, or zooming trigger a full repaint, and with autosize every task lives in the DOM, so that repaint is heavy. That’s the source of the lag.
But if you only need the fully-expanded chart for the export to PDF, then you can keep autosize off, and switch it on only before export, then off again:
gantt.config.autosize = "y";
gantt.render();
// ...generate the file / print...
gantt.config.autosize = false;
gantt.render();
You can also give the container a relative height and let Gantt scroll internally when rows overflow. That’s exactly what re-enables smart rendering, which keeps only the tasks in the viewport in the DOM and improves performance:
<!-- vh, %, or a flex child all work - no fixed pixel value needed -->
<div id="gantt_here" style="height: 80vh;"></div>
gantt.config.autosize = false;
gantt.init("gantt_here");
(If you use %, make sure the parent elements have a height; vh or a flex layout avoids that caveat.)
A note on the autosize value: if you’re currently using “xy” or “x”, the most expensive part is the timeline expanding to your full date range horizontally. If your widgets are stacked vertically (not placed left/right of the Gantt), you can drop horizontal growth and use autosize: “y”. Note that autosize: true already means “y”, so this only helps if you’re on “xy”/“x” today.
I’ve also forwarded your request to our development team to research what can be improved for this scenario. If there’s any update, I’ll let you know here.
Best regards,
Valeria Ivashkevich
DHTMLX Support Engineer