This is a migrated thread and some comments may be shown as answers.

How to get GanttTask dependant task

3 Answers 127 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Doc
Top achievements
Rank 1
Doc asked on 29 May 2015, 12:31 PM
I'm using Telerik's wpf gantt control and I'm trying to find a way to get dependant task from a specific one.

For example, given Task 2, I need to get a sort of task2.dependant which should be a list or an array with Task 3, Task 4, Task 5, etc.

(see attached screenshot)

but task's dependencies have only a .FromTask property, which in Task 2 case is Task 1

public interface IDependency
{
    // Summary:
    //     Represents the destination task of relation.
    IGanttTask FromTask { get; set; }
    //
    // Summary:
    //     Represents the type of relation between two tasks, such as finish to start,
    //     start to finish, start to start, and finish to finish.
    DependencyType Type { get; set; }
}

Is there an easy way than looping through ALL tasks to find the one
which depend from Task 2 and then looping for that one and so on?

3 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 02 Jun 2015, 10:51 AM
Hello,

Thank you for contacting us.

In the current version of the RadGanttView control when creating a Dependency between tasks that Dependency is added to the Dependencies property of the specific GanttTask. This enables a task to have multiple dependencies which is also why the Dependency requires its FromTask to be set. By design in the RadGanttView control the Dependencies property of a GanttTask contains only the direct dependent tasks to it rather than a list of all chain related tasks. Retrieving such list is currently not a built-in feature in the control and would require a custom implementation.

What you could do is loop over the TasksSource of the control and retrieve all of the GanttTask object that are considered "dependency" for a specific task. Hope this details are helpful and if we can be of any further assistance do not hesitate to contact us again.

Regards,
Vladi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Doc
Top achievements
Rank 1
answered on 03 Jun 2015, 07:15 AM
but continuously looping through the TaskSource is not performant if i have 300k+ tasks...
0
Accepted
Vladi
Telerik team
answered on 04 Jun 2015, 10:30 AM
Hi,

Implementing such "dependency chain" retrieval will indeed introduce performance drop as it requires the implementation of an advanced algorithm that will go though each task in the TaskSource and its Dependencies multiple times in order to find all of relations. As previously mentioned each task could have multiple tasks which are its direct dependency which would make implementing such algorithm even harder and lower the performance event further. By design the RadGanttView control has been developed to have the best performance it could have which is why such advanced "dependency chain" feature is not available as a built-in feature and only the direct dependencies are available.

An easier way of achieving the desired behavior could be to create such dependencies lists for each GanttTask when they are being created rather than finding them at run time. You could:
  • Create a custom GanttTask by inheriting the GanttTask and adding a property named for example DependencyChain that will contain the "dependency chain" collection of GanttTask objects
  • When creating each task and its dependencies in the ViewModel simply populate each task's DependencyChain collection.

 

As you see such appraoch would make it easier to pre populate such collections of dependencies rather than looking of them at run time but it is possible that such appraoch is not applicable depending on the way the TasksSource is created/retrieved. I created a sample project of the described appraoch for you and you can find it attached to my response. Hope this is helpful.

Regards,
Vladi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GanttView
Asked by
Doc
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Doc
Top achievements
Rank 1
Share this question
or