Set Day of Week in Recurrence Dialog

5 posts, 0 answers
  1. Scott
    Scott avatar
    34 posts
    Member since:
    Dec 2015

    Posted 02 Jul 2017 Link to this post

    How can I set it up so that when a user selects a day in the Scheduler, then selects to create a recurring appointment, the Edit Recurring Appointment dialog will, when Weekly recurrence type is selected, set the Day of Week to the Day of Week selected in the calendar, NOT the Day of Week in real-time.

    Thank you!

    -Scott

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

    Posted 04 Jul 2017 Link to this post

    Hello Scott, 

    Thank you for writing.  

    You can force the edit dialog for adding a new appointment to be shown by using a custom SchedulerSelectionBehavior. Here is demonstrated a sample code snippet:
    public RadForm1()
    {
        InitializeComponent();
        this.radScheduler1.SelectionBehavior = new CustomSchedulerSelectionBehavior(this.radScheduler1);
    }
     
    public class CustomSchedulerSelectionBehavior : SchedulerSelectionBehavior
    {
        public CustomSchedulerSelectionBehavior(RadScheduler scheduler) : base(scheduler)
        {
        }
         
        public override void SelectCell(SchedulerCellElement cell, bool extendSelection)
        {
            base.SelectCell(cell, extendSelection);
            DateTimeInterval dateTimeInterval = new DateTimeInterval();
            dateTimeInterval.Start = cell.Date ;
            dateTimeInterval.End = cell.Date;
            bool isRecurring = true;
            SchedulerResourceCollection resources = cell != null ? cell.View.GetResources() : null;
            this.Scheduler.AddNewAppointmentWithDialog(dateTimeInterval, isRecurring, resources);
        }
    }

    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 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Scott
    Scott avatar
    34 posts
    Member since:
    Dec 2015

    Posted 06 Jul 2017 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Dess-

    Thank you!

    -Scott
  4. Scott
    Scott avatar
    34 posts
    Member since:
    Dec 2015

    Posted 18 Mar 2018 Link to this post

    Hi Dess-

    Sorry took so long to get back...  I still need to address the last detail of my problem.  In the Edit Recurrence dialog, in the Recurrence Patten group box, I need it to pop up with Weekly selected and with the Day of the Week set to the Day of Week that was selected in the Scheduler.

    Thanks again.

    -Scott

  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3323 posts

    Posted 20 Mar 2018 Link to this post

    Hello, Scott, 

    Note that the EditRecurrenceDialog loads the information for the existing RecurrenceRule for the appointment that is being edited. Hence, if you are editing an existing appointment, it is normal to have that information coming from the appointment itself.

    However, you can create a custom EditRecurrenceDialog and override its LoadSettingsFromEvent method. Here is the appropriate place to load a WeeklyRecurrenceRule to the appointment before the data is loaded to the dialog. Thus, you can control what recurrence rule to be shown in the dialog. Here is a sample code snippet: 
    public RadForm1()
    {
        InitializeComponent();
     
        this.radScheduler1.RecurrenceEditDialogShowing += radScheduler1_RecurrenceEditDialogShowing;
    }
     
    CustomEditRecurrenceDialog dialog;
     
    private void radScheduler1_RecurrenceEditDialogShowing(object sender, RecurrenceEditDialogShowingEventArgs e)
    {
        if (dialog == null)
        {
            dialog = new CustomEditRecurrenceDialog(e.Appointment);
        }
        e.RecurrenceEditDialog = dialog;
    }
     
    public class CustomEditRecurrenceDialog : EditRecurrenceDialog
    {
        public CustomEditRecurrenceDialog(IEvent targetEvent) : base(targetEvent)
        {
             
        }
     
        protected override void LoadSettingsFromEvent(IEvent sourceEvent)
        {
            WeeklyRecurrenceRule rrule = new WeeklyRecurrenceRule();
            rrule.Start = (appointment != null) ? appointment.Start : DateTime.Now;
            rrule.WeekDays = WeekDays.Saturday;
            sourceEvent.RecurrenceRule = rrule;
            base.LoadSettingsFromEvent(sourceEvent);
        }
    }



    I hope this information helps. If you have any additional questions, please let me know. 

    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