We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Update of one event with recurrence fails with error in browser console : Cannot read property 'StartTime' of undefined

Thread ID:

Created:

Updated:

Platform:

Replies:

149594 Dec 2,2019 05:43 PM UTC Dec 23,2019 05:43 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: Scheduler
Johnny
Asked On December 2, 2019 05:43 PM UTC

Hi,

we are using the scheduler component in an asp.net core application. We have customized the editortemplate to:


<script id="EventEditorTemplate" type="text/template">
    <table class="custom-event-editor" width="100%" cellpadding="5">
        <tbody>
            <tr>
                <td class="e-textlabel">@DisplayName.CareProvider</td>
                <td colspan="4">
                    <span id="teammembername"></span>
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">@DisplayName.Location</td>
                <td colspan="4">
                    <input type="text" id="LocationId" name="LocationId" class="e-field" style="width: 100%">
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">@DisplayName.AppointmentType</td>
                <td colspan="4">
                    <input id="AppointmentTypeId" class="e-field" type="text" name="AppointmentTypeId" />
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">@DisplayName.From</td>
                <td colspan="4">
                    <input id="StartTime" class="e-field" type="text" name="StartTime" />
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">@DisplayName.To</td>
                <td colspan="4">
                    <input id="EndTime" class="e-field" type="text" name="EndTime" />
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <div id='RecurrenceEditor'></div>
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">@DisplayName.Patient</td>
                <td colspan="4">
                    <input id="PatientId" class="e-field" type="text" name="PatientId" />
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">@DisplayName.Description</td>
                <td colspan="4">
                    <textarea rows="5" id="Description" class="e-field e-input" name="Description"></textarea>
                </td>
            </tr>
        </tbody>
    </table>
</script>

In the onpopup we add extra's 

function onPopupOpen(args) {
    schedulesVue._data.errormessage = '';
    if (args.type === 'Editor') {
        let scheduleObj = document.getElementById('schedule').ej2_instances[0];

        let specParam = scheduleObj.dataModule.query.params.find(x => x.key == "TeammemberId");
        if (!specParam) {
            scheduleObj.dataModule.query.addParams("TeammemberId", schedulesVue._data.selectedCareprovider.Id);
        } else {
            specParam.value = schedulesVue._data.selectedCareprovider.Id;
        }
        scheduleObj.refreshEvents();

        args.element.querySelector('#teammembername').innerHTML = schedulesVue._data.selectedCareprovider.FullName;

        let locationElement = args.element.querySelector('#LocationId');
        if (!locationElement.classList.contains('e-dropdownlist')) {
            let dropDownListObject = new ej.dropdowns.DropDownList({
                // placeholder: @Json.Serialize(DisplayName.Location),
                fields: {
                    value: 'Id',
                    text: 'Name'
                },
                value: args.data.LocationId,
                dataSource: schedulesVue._data.locations
            });
            dropDownListObject.appendTo(locationElement);
        }

        let startElement = args.element.querySelector('#StartTime');
        if (!startElement.classList.contains('e-datetimepicker')) {
            new ej.calendars.DateTimePicker({ value: new Date(startElement.value) || new Date(), firstDayOfWeek: 1 }, startElement);
        }

        let endElement = args.element.querySelector('#EndTime');
        if (!endElement.classList.contains('e-datetimepicker')) {
            new ej.calendars.DateTimePicker({ value: new Date(endElement.value) || new Date(), firstDayOfWeek: 1 }, endElement);
        }

        let appointmentTypeElement = args.element.querySelector('#AppointmentTypeId');
        if (!appointmentTypeElement.classList.contains('e-dropdownlist')) {
            let dropDownListObject = new ej.dropdowns.DropDownList({
                // placeholder: @Json.Serialize(DisplayName.Location),
                fields: {
                    value: 'Id',
                    text: 'Description'
                },
                value: args.data.AppointmentTypeId,
                dataSource: schedulesVue._data.appointmentTypes
            });
            dropDownListObject.appendTo(appointmentTypeElement);
        }

        let recurElement = args.element.querySelector('#RecurrenceEditor');
        if (!recurElement.classList.contains('e-recurrenceeditor')) {
            let recurrObject = new ej.schedule.RecurrenceEditor({});
            recurrObject.appendTo(recurElement);
            recurrObject.setRecurrenceRule(args.data.RecurrenceRule);
            scheduleObj.eventWindow.recurrenceEditor = recurrObject;
        }
    } else if (args.type === 'QuickInfo') {
        if (args.data.Location) {
            args.element.querySelector('div .e-location-details').innerText = args.data.Location.Name;
        }
        let resource = args.element.querySelector('div .e-resource');
        if (resource) {
            let parent = resource.parentElement;
            parent.removeChild(resource);
        }
    }
}

Creating an event without recurrence : ok
Updating an event wihout recurrence : ok
Delete an event without recurrence : ok

Creating an event with recurrence : ok
Updating an event with recurrence, choosing Entire series : ok
Deleting an event with recurrence, choosing Entire series : ok

Updating event with recurrence, choosing This event: ERROR

constants.js:93 Uncaught TypeError: Cannot read property 'StartTime' of undefined
    at a (VM14024 ej2.min.js:10)
    at e.<anonymous> (VM14024 ej2.min.js:10)
    at e.notify (VM14024 ej2.min.js:10)
    at t.e.trigger (VM14024 ej2.min.js:10)
    at e.processOccurrences (VM14024 ej2.min.js:10)
    at e.saveEvent (VM14024 ej2.min.js:10)
    at t.saveEvent (VM14024 ej2.min.js:10)
    at e.processCrudActions (VM14024 ej2.min.js:10)
    at e.<anonymous> (VM14024 ej2.min.js:10)
    at e.notify (VM14024 ej2.min.js:10)

Any suggestions ?







Vinitha Devi Murugan [Syncfusion]
Replied On December 3, 2019 12:19 PM UTC

Hi Johnny, 
 
Syncfusion Greetings. 
 
We have checked the reported case with below sample but both this event and edit series working fine at our end.  
 
  
Kindly try the sample and if the issue persists, try to reproduce the error in a sample and revert or share runnable sample (if possible) to serve you better.  
Regards, 
M.Vinitha devi 


Johnny
Replied On December 20, 2019 06:26 AM UTC

Thank you. We were able to solve our problem thx to your input.

Vinitha Devi Murugan [Syncfusion]
Replied On December 23, 2019 05:43 AM UTC

Hi Johnny, 
 
You are most welcome 😊 
 
Regards, 
M.Vinitha devi 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon