Add parent to selectedItem & drap n drop

3 posts, 0 answers
  1. HWI CHEOL
    HWI CHEOL avatar
    8 posts
    Member since:
    Mar 2018

    Posted 01 Apr 2018 Link to this post

    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. Hristo
    Admin
    Hristo avatar
    1520 posts

    Posted 03 Apr 2018 Link to this post

    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.
  3. HWI CHEOL
    HWI CHEOL avatar
    8 posts
    Member since:
    Mar 2018

    Posted 10 Apr 2018 in reply to Hristo Link to this post

    A ha~ Thanks to your answer
Back to Top