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

disable / remove inline editor?

7 Answers 75 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 09 May 2011, 04:10 PM
Hi,

like the title it says. is there a property / way to disable the inline editor? Cant find such an option.


greetz

7 Answers, 1 is accepted

Sort by
0
Sean Overman
Top achievements
Rank 1
answered on 10 May 2011, 12:04 AM
I literally just got a answer for this from my telerik support ticket.

You need to implement your own SchedulerEditManager like follows:

class MySchedulerEditManager : SchedulerEditManager {
    public MySchedulerEditManager(RadSchedulerElement element) : base(element) { }
 
    public override bool BeginInlineEdit() {
        SchedulerVisualElement sve = this.SchedulerElement.ViewElement;
 
        if (sve is SchedulerDayViewGroupedByResourceElement) {
            foreach (SchedulerDayViewElement dv in ((SchedulerDayViewGroupedByResourceElement)sve).GetDayViewElements()) {
                dv.View.UpdateAppointments(this.SchedulerElement.Scheduler.Appointments);
            }
        } else if (sve is SchedulerMonthViewGroupedByResourceElement) {
            foreach (SchedulerMonthViewElement mv in ((SchedulerMonthViewGroupedByResourceElement)sve).GetMonthViewElements()) {
                mv.View.UpdateAppointments(this.SchedulerElement.Scheduler.Appointments);
 
                FieldInfo fi = mv.MonthViewAreaElement.GetType().GetField("appointments", BindingFlags.Instance | BindingFlags.NonPublic);
                List<AppointmentElement> appointments = (List<AppointmentElement>)fi.GetValue(mv.MonthViewAreaElement);
                for (int i = appointments.Count - 1; i >= 0; i--) {
                    if (!mv.View.Appointments.Contains(appointments[i].Appointment)) {
                        appointments.RemoveAt(i);
                    }
                }
            }
        }
 
        return false;
    }
}


then attached your class to the Scheduler.
this.RadScheduler1.SchedulerElement.EditorManager = new MySchedulerEditManager(this.RadScheduler1.SchedulerElement);

you may have to modify/extend this class, as I use groupmode = resource exclusively, and dont have to check for

SchedulerDayView, SchedulerWeekView, etc...

hope that helps.
0
Patrick
Top achievements
Rank 1
answered on 10 May 2011, 09:33 AM
that doesnt work for me. i always get a nullreference exception ;( even when i remove all your code except the constructor.

greets
0
Sean Overman
Top achievements
Rank 1
answered on 10 May 2011, 05:38 PM
are you passing an instance of the schedulerelement to the cotr?

this.RadScheduler1.SchedulerElement.EditorManager = new MySchedulerEditManager(this.RadScheduler1.SchedulerElement);
0
Patrick
Top achievements
Rank 1
answered on 12 May 2011, 09:34 AM
yes i did :)
even if i haven't passed it. why should i get a nullpointer exception? :)

greets
0
Stefan
Telerik team
answered on 12 May 2011, 09:39 AM
Hello Patrick,

Thank you for writing.

Currently, there is no property that allows for stopping the inline editor. However, such a feature was already requested in this PITS item. Feel free to add your vote to this request as well.

Meanwhile, to stop the inline editors, you have to override the SchedulerEditManager, and override the BeginInlineEdit method. Using this approach, appointments will not be created when starting to type in the scheduler cells, but the selection will be lost. However, we are planning to improve this functionality in one of the next releases. Here is the implementation needed to achieve this functionality: 
public Form1()
       {
           InitializeComponent();
           radScheduler1.SchedulerElement.EditorManager = new MySchedulerEditManager(radScheduler1.SchedulerElement);
       }
 
       class MySchedulerEditManager : SchedulerEditManager
       {
           public MySchedulerEditManager(RadSchedulerElement element) : base(element) { }
 
           public override bool BeginInlineEdit()
           {
               this.SchedulerElement.View.UpdateAppointments(this.SchedulerElement.Scheduler.Appointments);
               return false;
           }
       }

I hope that you find the provided information helpful. Should you have any other questions, do not hesitate to contact us.
 
Best wishes,
Stefan
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
0
Marty
Top achievements
Rank 1
answered on 18 Jun 2011, 12:45 PM
Maybe i'm missing something too but, do you mean  public SchedulerEditManager editManager { get; set; } ?
This works as expected for me, but the property 'EditorManager' just gives me null pointer issues like doesn't exist in the dll or something..
Maybe i've got an old version or something?
0
Stefan
Telerik team
answered on 22 Jun 2011, 12:56 PM
Hi Marty,

The provided code is for Q1 2011 SP1. Please make sure that you are using this version and the code will work correctly. Let me know whether it works for you.
 
Regards,
Stefan
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
Scheduler and Reminder
Asked by
Patrick
Top achievements
Rank 1
Answers by
Sean Overman
Top achievements
Rank 1
Patrick
Top achievements
Rank 1
Stefan
Telerik team
Marty
Top achievements
Rank 1
Share this question
or