Articles in this section

How to scroll to a specific date in Gantt chart timeline at initial load

To scroll the content to a specific date in Gantt chart timeline at initial load, use the create client-side event, which will be triggered when the Gantt chart is completely rendered in DOM.

 

The following code example explains how to set the focus to the specific date in Gantt chart timeline at initial load.

[cshtml]
 
<ej-gantt id="ganttSample" datasource="ViewBag.datasource"
              //..
              create ="create"              
</ej-gantt>
<script>
        function create(args) {
            var ganttObj = $("#ganttSample").ejGantt("instance"),
                date = new Date('03/05/2017'), // Set date as per your requirement  
                scrollObj = $("#ganttSample").find(".e-ganttviewerbodyContianer").ejScroller("instance"),
                updatedLeft = ganttObj._getTaskLeft(date);
            scrollObj.scrollX(updatedLeft)
        }
</script>

 

A sample to demonstrate above functionality is available here.

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied