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

Manually set focus and scroll to a Task


When the ejGantt is loading, I would like to set the focus and scroll to a particulary Task.
I tried to set the SelectedItem in the DataBound event without success.

Is there a way to perform this ?

Thanks, Rémi.

3 Replies

JR John Rajaram Syncfusion Team July 27, 2015 09:18 AM UTC

Hi Rémi,

Thanks for using Syncfusion Products.

At present there is no built-in support in Gantt to focus specific taskbar item on loading. For this we have already logged a feature request regarding this.

A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.


But currently we can achieve your requirement through workaround at sample level with “Create” client side event, which will focus and scroll the Gantt chart to the today’s taskbar item.

Please refer the following code snippets for more details.

Code snippets:

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

        <ej:Gantt ID="Gantt" runat="server"





            function create(args) {

                var proxy = this;

                var dt = new Date();

                var startDate = Globalize.parseDate(args.model.scheduleStartDate, this.model.dateFormat);

                var result = Math.round((dt - startDate) / (1000 * 60 * 60 * 24));

                var left = result * 30;

                $("#ganttviewerbodyContianerejGanttChart" + this._id).ejScroller("option", "scrollLeft", left);

                $("#ganttviewerheaderContainerejGanttChart" + this._id).scrollLeft(left);




Please find the sample in the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/119725/ze/SampleFocusTaskbar-1870530348

Please let us know if you have any questions about this.
John R

Rémi July 27, 2015 01:10 PM UTC

Thanks that helped me a lot to achieve my requirement.

A last request, is it possible to programmatically select a row depending on a task ID ?


MK Mahalakshmi Karthikeyan Syncfusion Team July 28, 2015 04:14 PM UTC

Hi Remi,

For your kind information, at present there is no support to update the scroller at load time for the particular task Id. But we can select any row at load time with the help of “SelectedRowIndex” and focus that particular row in the “Create” client side event. Please refer the below code snippet to achieve this.

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

<ej:Gantt ID="Gantt" runat="server" AllowColumnResize="true" TaskIdMapping="TaskID"






            function create(args) {

                var ganttObj = $("#MainContent_Gantt").data("ejGantt");





We have also prepared sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/119725/ze/SampleFocusTaskbar-1740726231

We will consider to achieve any row to be focus at the load time in the feature we have already logged.


Mahalakshmi K.

Live Chat Icon For mobile
Up arrow icon