Accessing RecurrenceRule in AppointmentInsert event

3 posts, 1 answers
  1. Nathan
    Nathan avatar
    2 posts
    Member since:
    Jan 2015

    Posted 20 Dec 2016 Link to this post

    I am setting a default recurrence rule in the FormCreated event when opening an advanced insert form as described at http://docs.telerik.com/devtools/aspnet-ajax/controls/scheduler/recurrence-editor/server-side-programming/populating-the-recurrence-rule

     

    When the Save button is clicked, I am attempting to read the recurrence rule from e.Appointment.RecurrenceRule. This always returns the default rule that I set in FormCreated, even if the user altered the recurrence settings in the form before clicking Save. If I do not set the recurrence rule in FormCreated, this returns the settings that the user chose as expected.

     

    Is there any way to set the default recurrence settings that are shown when the form is opened and still access the user's chosen settings in the AppointmentInsert event?

  2. Nathan
    Nathan avatar
    2 posts
    Member since:
    Jan 2015

    Posted 21 Dec 2016 in reply to Nathan Link to this post

    Also, more generally, I am trying to show the form for a new recurring event when double-clicking on an empty timeslot. So if there is a way to do that without setting the RecurrenceEditor's recurrence rule in FormCreated, that would also be helpful.
  3. Answer
    Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    394 posts

    Posted 23 Dec 2016 Link to this post

    Hi Nathan,

    At the server FormCreated event will be triggered when the form is created and when it is closed, its implementation overrides the changes made by the user. Therefore, all events will be saved with the default Recurrence configuration. As in most cases this is not the desired result, I would suggest you to use the ClientFormCreated even. In that event you could simply access the Recurrence DropDownList and set its selected item to "Daily", for example:
    function onFormCreated(sender, args) {
        if (Telerik.Web.UI.SchedulerFormMode.AdvancedInsert == args.get_mode()) {
            var reccurenceDropDown = $find('rs_Form_RecurrentAppointmentDropDown');
            var item = reccurenceDropDown.findItemByText('Daily');
            item.select();
        }
    }

    Attached you will find a simple implementation of the above.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    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.
Back to Top