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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Restore previous position

Thread ID:





141287 Dec 4,2018 12:06 PM UTC Dec 19,2018 11:29 AM UTC jQuery 3
Tags: ejGantt
Tomasz Tomczykiewicz
Asked On December 4, 2018 12:06 PM UTC


I recreate Gantt chart and it sets the visible section of the chart to the top. I want to stay in the same visible section. How can I achieve this?

Best regards,
Tomasz Tomczykiewicz

Punniyamoorthi Elangovan [Syncfusion]
Replied On December 5, 2018 01:22 PM UTC

Hi Tomasz, 
Thank you for contacting Syncfusion support. 
We have analyzed your requirement. In Gantt we can get the current top position of the scrollbar using scrollbar instance and dynamically set that scrollTop using setScrollTop public method. Please refer the below code example for this 
<script type="text/javascript"> 
        var previousScrollTop = 0;   
     $(function () { 
          var data = ej.DataManager(projectData); 
                    dataSource: data, 
                     actionComplete: function (args) { 
                        if (args.requestType == "create") { 
                            this.setScrollTop(previousScrollTop); // updating the Gantt with previous scrollTop value 
$("#updateRecord").click(function () { 
      //codes for getting the previous scrolltop value 
        var ganttObj = $("#GanttContainer").ejGantt("instance"), 
                scrollObj = $("#GanttContainer").find(".e-ganttviewerbodyContianer").ejScroller("instance"); 
                previousScrollTop = scrollObj.model.scrollTop; 
We have prepared the sample for your reference, please find the sample link below 

Tomasz Tomczykiewicz
Replied On December 18, 2018 02:32 PM UTC

Hi Punniyamoorthi,

Thank you for your replay, but your solution doesn't work on my case.
I attached my code with your solutions and please check why it doesn't work.
First, you have to open a terminal in the folder and install all npm packages (command "npm i"). Then you can open file index.html.

Best regards,
Tomasz Tomczykiewicz

Attachment: setScrollTop_76fb462c.zip

Punniyamoorthi Elangovan [Syncfusion]
Replied On December 19, 2018 11:29 AM UTC

Hi Tomasz,  
Sorry for the inconvenience caused. 
We have checked your attached sample. We suggest you to set the previous scrollTop value to the Gantt control in create client side event to overcome the reported issue. Please refer the below code example for this 
function createGantt() { 
    const projectData = cloneDeep(sampleData); 
    const gantt = $("#GanttContainer") 
            dataSource: projectData, 
            dateFormat: DATE_FORMAT.SYNCFUSION, 
            create: function (args) { 
We have prepared the sample for your reference, please find the sample link below 
Note: In our previous attached sample we had pass the Data to Gantt control using ejDataManager support, in this scenario the actionComplete client side event will trigger with argument requestType value as “create” once the Gantt control gets rendered. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon