<script type="text/javascript">
var previousScrollTop = 0;
$(function () {
var data = ej.DataManager(projectData);
$("#GanttContainer").ejGantt({
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;
ganttObj.destroy();
}) |
function createGantt() {
const projectData = cloneDeep(sampleData);
removeTime(projectData);
formatName(projectData);
const gantt = $("#GanttContainer")
.ejGantt({
dataSource: projectData,
dateFormat: DATE_FORMAT.SYNCFUSION,
create: function (args) {
this.setScrollTop(previousScrollTop);
}
//..
}); |