This is a migrated thread and some comments may be shown as answers.
I want set readonly ganttview item
1 Answer 14 Views
This is a migrated thread and some comments may be shown as answers.
HWI CHEOL
Top achievements
Rank 1
HWI CHEOL asked on 16 Mar 2018, 03:21 AM

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.

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Mar 2018, 08:58 AM
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.
Asked by
HWI CHEOL
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or