Category / Section
How to scroll to a specific date in Gantt chart timeline at initial load
1 min read
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.