GanttView scroll to today

Posted by: jay on 4 March 2020, 8:27 pm EST

    • Post Options:
    • Link

    Posted 4 March 2020, 8:27 pm EST

    With looking through the forms I found the only way so far to accomplish scrolling to today without setting today as the project start (Lose history doing that) is to add a task for today, scroll to it, then delete it. The issue with this is when I run my program the customgroup shows a header called “No Value” and I can’t delete it or hide it. Short of creating a test item to scroll to today which is assigned to an existing group is there another way?

    Also, I plan to disable linking tasks, is this possible?

  • Posted 5 March 2020, 5:33 am EST

    Hello,

    To scroll to a particular date use the ScrollPosition property of GanttView to do the same.

    c1GanttView1.ScrollPosition = new TaskDatePoint(c1GanttView1.Tasks[0], c1GanttView1.StartDate);
    

    >>Also, I plan to disable linking tasks, is this possible?

    If you don’t want to show the links line then you can set the ShowLinks property to false.

    If there is some other understanding then please let us know and provide a stripped-down sample with the screenshots that show your requirements.

    Regards,

    Prabhat Sharma.

  • Posted 5 March 2020, 12:05 pm EST

    This doesn’t work and I’m guessing it’s because task(0) doesn’t exist on today’s date. I get no errors but the initial start position stays at the oldest date created which is from June 2019 in this case. The issue seems to be because the scroll is tied to tasks so in a way this doesn’t work any different than ScrollToTask. As mentioned above though adding a task to set the date then delete it has a side affect of showing a unwanted group header. Is there something I’m missing? I just want to set the scroll position to today regardless of tasks.

    C1GanttView1.ScrollPosition = New TaskDatePoint(C1GanttView1.Tasks(0), Date.Today)

    Using C1GanttView1.ChartStartDate = Date.Today works but I lose the ability to view anything older than today which I don’t want. As for the linking, showlinks at false hides the display but still allows you to link while dragging the line. If you drag a task ahead 2 weeks and accidentally drag it too far down to the row below it auto starts to link and even if you move your cursor back to the correct line it continues the link unless you press esc and start over. I just want to remove the ability to link at all as it’s not needed for my scenario.

    Thanks,

    Jason

  • Posted 6 March 2020, 7:02 am EST

    Hi Jason,

    ScrollPosition property is working fine at our end, just the necessary condition is that Today’s date should lie between GanttView’s Start and Finish date. Please make sure this condition is true at your end and try this property on a button click.

    >> I just want to remove the ability to link at all as it’s not needed for my scenario.

    It is a designed behavior that can not be changed. All you can do is set the ShowLinks property to false and in the AfterEditTask event of GanttView call the Clear method of Task predecessors as given below:

    private void C1GanttView1_AfterEditTask(object sender, CancelTaskArgs e)
      {
        e.Task.Predecessors.Clear();
      }
    
    

    Regards,

    Prabhat Sharma.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels