Can I make the horizontal scrollbar always display


#1


#2

Hi @kevinyaoooooo!

At the moment, the Gantt has no such functionality.
As a workaround, you can overwrite the internal _resizeScrollbars method in order to prevent hiding not active scrollbars.

Assign it an empty function during the onGanttLayoutReady event.
https://docs.dhtmlx.com/gantt/api__gantt_onganttlayoutready_event.html

After that, the scrollbars will always display.
Here is a sample, where you can see how to do it:

I can not guarantee that this method will work after updates of the gantt in the future.


#3

This solution doesn’t seem to work for me anymore as of version 7.1.6. I had luck overriding resizeScrollbars with this custom function though.

gantt.$ui.getView(“main”).constructor.prototype._resizeScrollbars = function (autosize, scrollbars) { scrollbars.forEach((scrollBar) => scrollBar.$parent.show())};


#4

Hello Daniel,
With a simple configuration, both solutions work correctly:
http://snippet.dhtmlx.com/5/cfaa3af7d
http://snippet.dhtmlx.com/5/3ad747253

However, you can use a custom layout configuration. It is possible to add the group property to the scrollbar layout cell. Then, you can link several scrollbars. If at least one scrollbar needs to be displayed, Gantt will show all of them:
https://docs.dhtmlx.com/gantt/desktop__layout_config.html#visibilitygroups
It means that you can create an empty timeline view with the grouped scrollbar. After adding the width: 1 parameter, the timeline will always be scrolled. That means that Gantt will always display the scrollbar for the main timeline:
http://snippet.dhtmlx.com/5/c7311e7d8