Hello. I tried to add validations for the create and edit methods of my scheduler. These validations work for the create method, but do not work for the edit method. Please note that I was unable to use "click: this.scheduleObj.eventWindow.eventSave.bind (this.scheduleObj.eventWindow)" for the edit button, because the data is passed on the OnActionBegin method with request-type eventCreate and so I could not perform the edit action.
Here is the simple reproduction of the problem :
https://stackblitz.com/edit/react-qpyuri-uujhyv?file=index.js
Do you think you can help me add validations for the edit method and send the data to onActionBegin with the "eventChange" requestType?
index.js:
dialog.buttons = [ { buttonModel: { content: 'Delete', cssClass: 'e-primary e-event-delete e-hide', }, }, { buttonModel: { content: 'Cancel', cssClass: 'e-event-cancel e-hide', }, click: this.scheduleObj.eventWindow.dialogClose.bind( this.scheduleObj.eventWindow ), }, { buttonModel: { content: 'Edit', cssClass: 'e-primary e-event-save', isPrimary: true, allowDragAndDrops: false, }, //click: this.eventEdit.bind(this), click: this.scheduleObj.eventWindow.eventSave.bind( this.scheduleObj.eventWindow ), }, ]; |
Hi,Satheesh Kumar .
If I try as you suggested, the validations work, but there is another problem when the data is passed to the OnActionBegin method, event is sent with the "eventCreated" requestType and not "eventChanged" as it should normally be when Edit button was pressed
That's what I tried to explain at the beginning of the thread.
I am attaching 2 solutions (Back End and Front End) where I replicated the problem.
Attachment: ValidationProblemApps_3943082e.rar
Hi Cezar,
We have checked on your shared codes and let you know that the eventData was tried to ‘Add’ in the openEditor method which resulted in requestType as eventCreate in the OnActionBegin method. Hence, we suggest you frame the Id value and pass it to the openEditor method in the OnPopupOpen method like the below code snippet to overcome the reported issue.
let eventData = {
Id: args.data.Id,
StartTime: args.data.StartTime,
EndTime: args.data.EndTime,
SubjectId: subject.Id,
Subjects: subjects,
Classes : classes,
ClassId : currentClass.Id
};
this.scheduleObj.openEditor(eventData, args.data.Id ? 'Save': 'Add', true);
dialog.headerEle.querySelector('.e-title-text').innerText = 'Actualizeaza interval orar';
Kindly try the above solution and let us know if this meets your requirement.
Regards,
Ruksar Moosa Sait
Thank you very much Ruksar Moosa , it works !
Hi Cezar,
Thanks for the update.
We are happy that your problem has been resolved now.
Regards,
Satheesh Kumar B