How to scroll a selected task into view?


Let’s say I have more tasks than can be displayed onscreen. If I select a task that is off-screen using


how do I automatically scroll it into view?

(I’ve looked at the documentation and the only thing I’ve found related to scrolling is to do it to a x/y position, which isn’t a help without a way of converting the task id to an y position. And I found no hint anywhere on how to do that conversion.)

Fred S


You can click on the required task in grid for displaying it on the screen.
Click on the event “Task 3.3” and it will be displayed on the screen: … onfig.html

Perhaps I wasn’t making myself clear enough. I’m looking for a solution to do it programmatically. Meaning using code. Not user interaction.

Found any solution for this?

Hi @Srdjan_Stajic,
For now, it could be done using the getTaskPosition method, which provides the functionality, to find the task’s position on the chart. After that you will be able to move to this position using the scrollTo method, it may look like in this code fragment:

var task = gantt.getTask(id);
var sizes = gantt.getTaskPosition(task, task.planned_start, task.planned_end);

Here is a demo: