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

Add parent to selectedItem & drap n drop

2 Answers 31 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
HWI CHEOL
Top achievements
Rank 1
HWI CHEOL asked on 02 Apr 2018, 01:00 AM

Hello~~

I  have two question.

I need your help.

1. Add parent to selectedItem

privite void Buttom1_click(object sender, EventArge e)

{

    // Add parent to selectedItem

   // raising error

   GanttViewDataItem item = new GanttViewDataItem();

     item.Items.Add(radGanttView1.SelectedItem);

    radGanttView1.Items.Add(item);

}

2. GanttViewTextItemEelement Drap & drop is possible to change parent & child?

 

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 03 Apr 2018, 01:15 PM
Hello,

RadGanttView supports drag and drop of the task elements in graphical. The drag and drop service is responsible for resizing and moving of the task elements. At the moment reordering of the tasks in the text view is not supported. We have a feature request logged on our feedback portal, here: ADD. RadGanttView - add .ability to drag and drop tasks in the text part, so the items can be rearranged vertically as well. You can subscribe to the item and be updated when its status changes. In the meantime, you can use the standard OLE drag-drop to create your own drag-drop functionality. You should manipulate the items straight in your data source if you use RadGanttView in bound mode. Additional information is available in the following MSDN thread: https://msdn.microsoft.com/en-us/library/96826a87.aspx.

If you want to add a parent of the currently selected item you will need to add a new task to your RadGanttView. If you are in an unbound mode you can create the new item, remove it from its paren`s Items collection and then add it to the new task which will be its new parent. Then the new parent can be added to the Gantt control, in the code snippet below the new parent is added as a child of the old parent: 
GanttViewDataItem selectedItem = this.radGanttView1.SelectedItem;
if (selectedItem != null)
{
    GanttViewDataItem oldParent = selectedItem.Parent;
    oldParent.Items.Remove(selectedItem);
    GanttViewDataItem newParent = new GanttViewDataItem() { Title = "New Parent" };
    newParent.Items.Add(selectedItem);
    oldParent.Items.Add(newParent);
}

If you want to create a new root item you can add it straight to the Items collection of the control. In bound mode, you will need to change the data source object to reflect the new relations between the items and then rebind the control.

I hope this helps. Let me know if you have other questions.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
HWI CHEOL
Top achievements
Rank 1
answered on 10 Apr 2018, 11:22 PM
A ha~ Thanks to your answer
Tags
GanttView
Asked by
HWI CHEOL
Top achievements
Rank 1
Answers by
Hristo
Telerik team
HWI CHEOL
Top achievements
Rank 1
Share this question
or