We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Gantt Chart Custom Scroll Behavior

By default, if you click on a task row, the chart pane automatically scrolls to the start of the task, if the start date exists.

Is there a way to override/modify the auto scroll behavior on the Gantt chart so that when you click on a task row, if there is no start date, to scroll to the baseline start date (if it exists)?


1 Reply

MS Monisha Sivanthilingam Syncfusion Team December 12, 2022 06:50 AM UTC

Hi Richard,


Greetings from Syncfusion support.


We can achieve your requirement by setting the autoFocusTasks property to false if the task has no start date defined to it in the rowSelecting event. We can also use the scrollToDate method to scroll to the baselineDate when the tasks does not have a start date.


Index.cshtml

 

<script>

  function rowSelecting(args) {

    var ganttObj = document.getElementById("Gantt").ej2_instances[0];

    if (args.data.StartDate == null) {

      ganttObj.autoFocusTasks = false;

      if (args.data.BaselineStartDate != null) {

        ganttObj.scrollToDate(args.data.BaselineStartDate);

      }

    } else {

      ganttObj.autoFocusTasks = true;

    }

  }

</script>

 


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/F_179310599663785


Regards,

Monisha.


Loader.
Up arrow icon