I want set readonly ganttview item

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

    Posted 15 Mar 2018 Link to this post

    DataSet ds = new DataSet();

    DataTable dt = new DataTable();

    dt.TableName = "Tasks";

    dt.Columns.Add("Id");

    dt.Columns.Add("ParentID");

    dt.Columns.Add("Title");

    dt.Columns.Add("Start", typeof(DateTime));

    dt.Columns.Add("End", typeof(DateTile));

     

    dt.Rows.Add("1", "","Item1", new DateTime(2018,03,16), new DateTime(2018,03,20);

    dt.Rows.Add("2","1","child", new DateTime(2018,03,16), new DateTime(2018,03,17);

    dt.Rows.Add("3","","Item2", new DateTime(2018,03,16), new DateTime(2018,03,20);

    ds.Tables.Add(dt);

    this.radGanttView1.DataSource = ds;

    radGanttView1.Items[0].ReadOnly = true;

    radGanttView1.Items[0].Items[0].ReadOnly = true;

    radGanttView1.Items[0].NextItem.ReadOnly = true;

     

     Item2  is not moving  but Item1 is still moving

    I want Item1 is not moving too.

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3624 posts

    Posted 16 Mar 2018 Link to this post

    Hello,  
    Thank you for writing.  

    The GanttViewDataItem.ReadOnly property is not respected when you start moving an item. If you set the RadGanttView.ReadOnly to true the items won't be movable. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

    I have also updated your Telerik points.

    Currently, the possible solution that I can suggest is to use a custom BaseGanttViewBehavior

    this.radGanttView1.GanttViewElement.GanttViewBehavior = new CustomBaseGanttViewBehavior();

    public class CustomBaseGanttViewBehavior : BaseGanttViewBehavior
    {
        protected override void ProcessMouseDownOnTaskElement(GanttGraphicalViewBaseTaskElement element, MouseEventArgs e)
        {
            GanttGraphicalViewBaseItemElement taskItem = element.Parent as GanttGraphicalViewBaseItemElement;
             
            if (e.Button == MouseButtons.Left && !taskItem.Data.ReadOnly)
            {
                base.ProcessMouseDownOnTaskElement(element, e);
            }
        }
    }

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