RadGanntchart – adding dependencies dynamically

5 posts, 0 answers
  1. Graeme
    Graeme avatar
    5 posts
    Member since:
    Jun 2012

    Posted 04 Oct 2013 Link to this post

    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

  2. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 08 Oct 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Graeme
    Graeme avatar
    5 posts
    Member since:
    Jun 2012

    Posted 08 Oct 2013 Link to this post

    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?
  5. Graeme
    Graeme avatar
    5 posts
    Member since:
    Jun 2012

    Posted 09 Oct 2013 Link to this post

    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
  6. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 11 Oct 2013 Link to this post

    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 >>
Back to Top
DevCraft banner