Click task to locate the resource

Hi! When I click on the task, can I display the first resource according to the array of resources bound to the job?

When you click on a task in the grid, Gantt scrolls the timeline to show the task bar.
If the resource timeline uses the same scrollbar as the main timeline, it means that the resource timeline will be scrolled horizontally to the same position.
If you want to scroll it vertically, you need to implement a custom solution by using the Gantt API and Javascript.
You can scroll the resource timeline by using the scrollLayoutCell method:

Here is an example of how it can be implemented:

When I use this method, it says it’s not a functional method?

It seems that you don’t have the latest version. This method was added in the 8.0.0 version.
So, instead of that, you need to use the internal API to get the same functionality.

First, you need to get the scrollbar that is relevant to the layout cell you want to scroll by using the gantt.$ui.getView method. Then, you need to use the scrollTo method to scroll the scrollbar, then the layout cell will be scrolled.

For example, in the following snippet, you need to call the following code to scroll the resource timeline vertically:


onGanttScroll Whether the event is triggered before the onTaskSelected event

When you click to select a task in the Gantt chart, the scroll state of the Gantt chart is initialized with its current position, triggering the ‘onGanttScroll’ event. After the task is selected, the Gantt chart will scroll to the selected task at its new position, causing the scroll state to be updated.