Event save on Editor popup

Hi,
Is it possible to detect an event when you click on "save" in the popup editor?
I need to know when you press "save" and also know what data has changed.

Regards.

5 Replies

NR Nevitha Ravi Syncfusion Team September 13, 2018 11:34 AM UTC

Hi Juan, 

Yes it is possible to detect event creation and event updating on actionBegin event with the requestType as eventCreate and eventChange respectively. Please refer the below code.   

import { Component, ViewChild } from '@angular/core'; 
import { ScheduleComponent, EventSettingsModel, ActionEventArgs, WeekService, WorkWeekService } from '@syncfusion/ej2-ng-schedule'; 
import { scheduleData } from './datasource'; 
 
@Component({ 
  selector: 'app-container', 
  providers: [WeekService, WorkWeekService], 
  // specifies the template string for the Schedule component 
  template: `<ejs-schedule #scheduleObj width='100%' height='550px' [selectedDate]="selectedDate" [eventSettings]="eventSettings" (actionBegin)="onActionBegin($event)" > 
   <e-views> <e-view option="Week"></e-view> <e-view option="WorkWeek"></e-view> </e-views> </ejs-schedule>` 
}) 
export class AppComponent { 
    @ViewChild('scheduleObj') 
    public scheduleObj: ScheduleComponent; 
    public selectedDate: Date = new Date(2018, 1, 15); 
    public eventSettings: EventSettingsModel = { dataSource: scheduleData }; 
    onActionBegin(args: ActionEventArgs): void { 
        if (args.requestType === 'eventChange') { //while editing the existing event 
            console.log("event edit"); 
        } 
        if (args.requestType === 'eventCreate') { //while creating new event 
            console.log("event create"); 
        }  
    } 
} 

Note: The event object can be accessed through args.data

Kindly check the above code and let us know if you need further assistance on this. 

Regards, 
Nevitha. 



JU Juan September 13, 2018 11:40 AM UTC

Perfect!
Thanks very much.


VS Velmurugan S Syncfusion Team September 14, 2018 12:15 PM UTC

Hi Juan, 
You are welcome. 
We are glad that our solution helped you to meet your requirement. Please let us know if you need any further assistance.   

Regards, 
Velmurugan 



RR ramiro redona August 24, 2022 12:21 AM UTC

Hi Velmurgan, i have a problema similar this, i have the next interface, but when i try to edit any field, i cant bind well with the code, the 'ChangedRecords' has the object modificated but only changes of 'known properties'. following error is what i get trying binding in 'eventsettings'. 

this.eventSettings = {
        dataSource: recursos,
        fields: {
          id: 'Id',
          subject: { name: 'Subject', title: 'Cliente Anterior' },
          startTime: { name: 'StartTime', title: 'Hora inicio' },
          endTime: { name: 'EndTime', title: 'Hora Fin' },
          Customer:
        }
      };

(property) Customer: any
Type '{ id: string; subject: { name: string; title: string; }; startTime: { name: string; title: string; }; endTime: { name: string; title: string; }; Customer: any; }' is not assignable to type 'FieldModel'.
Object literal may only specify known properties, and 'Customer' does not exist in type 'FieldModel'


RM Ruksar Moosa Sait Syncfusion Team August 24, 2022 08:53 AM UTC

Hi Ramiro,


Greetings from Syncfusion support.


We have checked on your shared code snippet and let you know that eventSettings fields property only for the built-in fields. If you are using a custom field field with the Schedule hence it is not required to add with the eventSettings fields property. The custom fields value will be added automatically to the appointment when you add additional fields in the editor window or in the editorTemplate.


Kindly let us know if you need any further assistance on this.


Demo:

https://ej2.syncfusion.com/angular/demos/#/bootstrap5/schedule/editor-custom-field

https://ej2.syncfusion.com/angular/demos/#/bootstrap5/schedule/editor-template


UG:

https://ej2.syncfusion.com/angular/documentation/schedule/editor-template/#add-additional-fields-to-the-default-editor

https://ej2.syncfusion.com/angular/documentation/schedule/editor-template/#customizing-event-editor-using-template


Regards,

Ruksar Moosa Sait


Loader.
Up arrow icon