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

RadGanntchart – adding dependencies dynamically

4 Answers 81 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Graeme
Top achievements
Rank 1
Graeme asked on 04 Oct 2013, 03:01 PM

I am populating a gannt chart dynamically by looping through the tasks from a table. Some of these tasks have a parent-child relationship which I would like to show as dependencies on the gannt chart. I’ve found examples on these pages http://www.telerik.com/help/silverlight/radganttview-populating-with-data-viewmodel.html and http://www.telerik.com/help/silverlight/radganttview-features-items-relations.html which shows how to set up dependencies. However in these examples the parent tasks are hardcoded as variables. Are there any examples of how to do this dynamically ?

I presume as I’m looping through the collection I’ll have to find some way of referencing the relevant previous task item in the collection and add it as a dependency. However as I’m new to this and picking up someone else’s code it would be really handy if there was an example

Thanks in advance for any help

4 Answers, 1 is accepted

Sort by
0
Ventzi
Telerik team
answered on 08 Oct 2013, 12:37 PM
Hello Graeme,

 You are on the right way. If I understand you correctly you need to create dependencies dynamically between tasks which normally should have parent - child relation. In this case you need to add the tasks to the Dependencies collection of the GanttTask instead of the Children collection. Technically you need to preserve the parent task and add dependency to each of his "children" by setting the FromTask property to the preserved parent task. Unfortunately we haven't sample project which demonstrates this approach, but if you have any difficulties don't hesitate to contact us again. 

Regards,
Ventzi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Graeme
Top achievements
Rank 1
answered on 08 Oct 2013, 03:19 PM
Hi - thanks for your reply.

I'm still not sure how this will work. I'm currently adding Child tasks to the Milestones, and those tasks could also be parents of one or more other dependant tasks, which could also be parents of one or more other  dependent tasks, and so on.

The only way I can think to get started on showing the links between tasks is as I loop through the tasks to do another query to get any dependant tasks and add those as dependencies. However when I reach those dependent tasks in the loop and add them to the gantt chart how will it know these are the same tasks that have already been added as dependencies?
0
Graeme
Top achievements
Rank 1
answered on 09 Oct 2013, 01:24 PM
Ignore my previous post I was trying to do things the wrong way round and now see what you mean about preserving the Parent task.
Can you point me in the right direction of how I can preserve and reference the parent tasks? 
I'd need to be able to get the parent id of the current task and somehow reference the correct preserved task and add it as a dependency

thanks
0
Ventzi
Telerik team
answered on 11 Oct 2013, 11:43 AM
Hi Graeme,

 In your case you need to create dependencies between tasks which normally should have parent - child relations. This could be used for recognizing of the parent task (task with Children.Count > 0) and then you could add this task as dependency to each of the his children. I've prepared and attached a sample project which demonstrates this approach. 

Hope this helps.

Regards,
Ventzi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GanttView
Asked by
Graeme
Top achievements
Rank 1
Answers by
Ventzi
Telerik team
Graeme
Top achievements
Rank 1
Share this question
or