New child or sibling item

4 posts, 1 answers
  1. David
    David avatar
    5 posts
    Member since:
    Nov 2015

    Posted 15 Dec 2015 Link to this post

    Hi, Im still working on my project that uses GanttView. Data are linked to sql server database using a dataset. My problem occurs when I try to add a child or sibling item, because the new item does not appear until the data are saved to db, and I query again.

    Of course I'm using the 'ItemChildIdNeeded' event, to assign the correct id

    integerIdCounter = My last Id...

    Private Sub RadGanttView1_ItemChildIdNeeded(sender As Object, e As Telerik.WinControls.UI.GanttViewItemChildIdNeededEventArgs) Handles RadGanttView1.ItemChildIdNeeded
            Me.integerIdCounter += 1
            e.ChildId = Me.integerIdCounter
     End Sub

    What am I doing wrong?

  2. Dess
    Admin
    Dess avatar
    1607 posts

    Posted 16 Dec 2015 Link to this post

    Hello David,

    Thank you for writing.

    The ItemAdded event is fired on my end when adding a new child item for example. I have attached my sample project. Could you please specify the exact steps how to reproduce the problem or what changes I should perform in order to reproduce the experienced issue? Thank you in advance. 

    While working on your case, I have encountered a visual glitch when adding an item. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

    I am looking forward to your reply.

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. David
    David avatar
    5 posts
    Member since:
    Nov 2015

    Posted 16 Dec 2015 in reply to Dess Link to this post

    Thank you, now I have discovered where the problem was. I had used a 'bigint' type (Sql Server) for 'Id' and 'ParentId' fields. And it seems that are not compatible with GanttView. I have changed to 'int' and now works properly.

    Now I have another question, how can I change the Title task and the Start and End date before create the item? I have tried with this, but doesn't work. Any idea?? thank you.

     

    Private Sub RadGanttView1_ItemAdding(sender As Object, e As GanttViewItemAddingEventArgs) Handles RadGanttView1.ItemAdding
            e.Item.Title = "My custom task"
            e.Item.Start = Now
            e.Item.End = Now.AddDays(1)
    End Sub

     

  5. Answer
    Dess
    Admin
    Dess avatar
    1607 posts

    Posted 17 Dec 2015 Link to this post

    Hello David,

    Thank you for writing back.

    You can change the item's information after it is added successfully, not before that, e.g. in the Click event of the menu item:
     
    Private Sub RadGanttView1_ItemAdded(sender As Object, e As Telerik.WinControls.UI.GanttViewItemAddedEventArgs)
        addedItem = e.Item
    End Sub
     
    Private Sub RadGanttView1_ContextMenuOpening(sender As Object, e As Telerik.WinControls.UI.GanttViewContextMenuOpeningEventArgs)
        Dim item As RadMenuItem = DirectCast(e.Menu.Items(0), RadMenuItem)
        AddHandler item.Items(0).Click, AddressOf ItemClick
    End Sub
     
    Dim addedItem As GanttViewDataItem
    Private Sub ItemClick(sender As Object, e As EventArgs)
        Me.RadGanttView1.GanttViewElement.GraphicalViewElement.Update(Telerik.WinControls.UI.RadGanttViewElement.UpdateActions.ExpandedChanged)
        addedItem.Title = "My custom task"
        addedItem.Start = addedItem.Start.AddDays(2)
        addedItem.End = addedItem.Start.AddDays(4)
    End Sub

    I hope this information helps. If you have any additional questions, please let me know.

    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