Gantt Horizontal Infinite Scroll



I’m trying to implement infinite scroll on horizontal scrollbar, so that when the user scrolls to the end of the timeline max date is automatically updated by 2 days.

So far the best thing I’ve written is:

  function (_left, _top) {
    const grid = document.getElementsByClassName('gantt_task')[0]

    if (grid.scrollLeft + grid.clientWidth === grid.scrollWidth) {
      gantt.getState().max_date =
      grid.scrollLeft -= 10

However it’s not working.
Could use some help here.

Thanks in advance


Hello Bartosz,
Usually, Gantt displays the dates in the timeline depending on the task dates. Otherwise, you need to specify the displayed date range with the gantt.config.start_date and gantt.config.end_date parameters:
Modifying the dates returned by the getState method won’t make any change as it is a read-only property:
Here is an example of how it might be implemented:
Please, note, that the approach will work only while the user scrolls the timeline. As soon as the scrollbar reaches the most left or right position, the event won’t fire.