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

New child or sibling item

3 Answers 72 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 15 Dec 2015, 11:31 AM

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?

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Dec 2015, 08:50 AM
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
0
David
Top achievements
Rank 1
answered on 16 Dec 2015, 05:26 PM

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

 

0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Dec 2015, 11:20 AM
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
Tags
GanttView
Asked by
David
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
David
Top achievements
Rank 1
Share this question
or