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
close icon

Manually set focus and scroll to a Task

Hi,

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.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

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"


         //...


        Create="create"

        </ej:Gantt>

        <script>

            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);

            }          

        </script>

    </asp:Content>


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.
Regards,
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 ?

Rémi.


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"

//…

Create="create"

SelectedRowIndex="11"> 

</ej:Gantt>

        <script>

            function create(args) {

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

                ganttObj._$treegridHelper.ejTreeGrid("updateScrollBar");

            }          

        </script>

    </asp:Content>


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.

Regards,

Mahalakshmi K.


Loader.
Live Chat Icon For mobile
Up arrow icon