Adding the First Item to a Ganttview

4 posts, 0 answers
  1. Marius
    Marius avatar
    9 posts
    Member since:
    Dec 2014

    Posted 18 Feb Link to this post

    Hi All

    Me again ;)

    I have tried to search, but cannot find the answer.

     

    I have a DataSet I use for the gantview. All the properties is correct, but on the first time a user uses it, there is still no data, so it is an empty Dataset.

    On this empty Gantview though, there is no Context Menu, so here is my question: How do a User add the First Task to an Empty Ganttview ?

     

    Regards

     

    Marius

  2. Marius
    Marius avatar
    9 posts
    Member since:
    Dec 2014

    Posted 18 Feb Link to this post

    I Found a work around, by simply adding a Menu Item to add a "Semi Blank" new task. Now however , I have an issue, that since my data is bound to an external Database, when something is deleted, I need to also deleted it from the remote Database. The Ganttview removes it from the displayed collection, but I am not able to "catch" the relevant item that is being deleted ( I checked ItemRemoved, but can not seem to find the ID of the item that was removed)
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Marius
    Marius avatar
    9 posts
    Member since:
    Dec 2014

    Posted 19 Feb Link to this post

    Me Again :)

    I have figured out how to delete my items:

    DataSet newds = (DataSet)radGanttView1.DataSource;
    List<int> newids = (from DataRow dr in newds.Tables["Tasks"].Rows select int.Parse(dr["ID"].ToString())).ToList();
    MainForm._service.DeleteTask(newids);

     

    public void DeleteTask(List<int> ExistingIDs)
    {
    List<> result = (from i in _db.where !ExistingIDs.Contains(i.ID) && i.IsDeleted == false select i).ToList();
    foreach (tasktoDelete in result)
    {
    tasktoDelete.IsDeleted = true;
    try
    {
    _db.SaveChanges();
    }
    catch (Exception se)
    {
    string error = se.Message;
    }
    }
    }

    Now this brought another interesting Issue to my attention. In Project Management, Linking Items most of the times creates dependencies, and Based on the Type of link There is certain things that need to happen to the relevant Child/Sibling Items i.e.

     

    If an Item is Linked FinishToStart and I modify the Start Item's End Date, The Linked Childs StartDate needs to be moved on.

    Now I can Handle this on the ItemChanged Event, But how can I easily pickup/get the relevant "Linked Items" ?

     

    Regards

     

    Marius

     

  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 19 Feb Link to this post

    Hello Marius,

    Thank you for writing.
     
    By default, RadGanttView offers a context menu allowing you to delete the selected item. Additional information is available here: http://docs.telerik.com/devtools/winforms/ganttview/context-menu/default-context-menu. Thus, when a certain item is removed from the bound RadGanttView, the associated links are automatically deleted as well.

    In order to detect the affected links, you can iterate the RadGanttView.Links collection and find which links contain the deleted item as start/end item. Thus, you can extract the affected items as well.

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    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
Back to Top