So I've been trying to figure out why when I hit the Save button on the Editor window that pops up after hitting Add Event, nothing happens. I was able to Insert the basic record into my database in the OnNewEventAdd method. This will insert a record into my database and I am able to retrieve it fine. I can't seem to update any records or add them using the Editor window though. I searched through the code trying to find the code for the Save button but got nowhere. I looked through the guide but nothing I found in there looked like how other components database interactions have gone.
private async void OnNewEventAdd()
{
DateTime Date = this.ScheduleRef.SelectedDate;
DateTime Today = DateTime.Now;
Events eventData = new Events
{
Subject = "",
StartTime = new DateTime(Date.Year, Date.Month, Date.Day, Today.Hour, 0, 0),
EndTime = new DateTime(Date.Year, Date.Month, Date.Day, Today.Hour + 1, 0, 0),
Location = "",
Description = "",
IsAllDay = false,
CalendarId = this.ResourceRef.Value[0],
CreatedBy = userName,
CreatedDate = DateTime.Now,
ChurchInfo_ChurchID = ChurchID
};
await _db.Events.AddAsync(eventData);
await _db.SaveChangesAsync();
await ScheduleRef.OpenEditorAsync(eventData, CurrentAction.Add);
}
When it runs through that code, with my _db.Events lines, it's able to insert that record into my database. Is there a way to access the code behind that Save button so I can get this working?
Hi Andrew,
Greetings from Syncfusion Support.
We let you know that you can save the appointments dynamically and also behind the Save button by making use of the AddEventAsync public method of the Scheduler as like the below UG. So we would suggest you to refer the below link to know more details about the method.
UG: https://blazor.syncfusion.com/documentation/scheduler/crud-actions#creation-using-addeventasync-method
Kindly refer and try the above solution and let us know if you need further assistance.
Regards,
Balasubramanian S
Sorry for taking so long to reply, I was working on my Charts which took a bit longer than expected. I looked at the guide you gave me. That doesn't seem to help me as I'm trying to get the data from this:
await ScheduleRef.OpenEditorAsync(eventData, CurrentAction.Add);
It opens the editor in a popup window and I need the data from that screen, like screenshot below:
I'm trying to access that save button since right now when I click it nothing happens.
Thanks,
And
Hi Andrew,
You can get the shared editor window's event data by using OnActionBegin event of the EventCreate requestType. And also we suspect that you might have a console error when clicking the Save button. Due to this problem, you couldn't save the appointment. So, can you please share the console error message if occurred? If not occurred share the scheduler-related code snippet to validate the issue and provide a prompt solution ASAP?
Regards,
Balasubramanian S
Sorry it took me so long to reply, I focused on other parts of my program first and just now able to get back to this issue. I just started my scheduler fresh from scratch. It does work but only if I'm editing an existing event. The Edit Event window works as expected but if I'm trying to start a new event via the New Event editor window, nothing happens when I select the Save button and there is no console error. My scheduler code is below.
<SfSchedule TValue="Events" Width="100%" Height="100%">
<ScheduleEventSettings DataSource="@EventsList" EnableTooltip="true"></ScheduleEventSettings>
<ScheduleEvents TValue="Events" OnActionBegin="@EventCreation" OnActionFailure="@EventFailure"></ScheduleEvents>
<ScheduleViews>
<ScheduleView Option="View.Day"></ScheduleView>
<ScheduleView Option="View.Week"></ScheduleView>
<ScheduleView Option="View.Month"></ScheduleView>
<ScheduleView Option="View.Agenda"></ScheduleView>
</ScheduleViews>
</SfSchedule>
Hi Andrew,
We have validated your issue and let you know that when a new event is created through the editor window and Saved, you need to update the events in the database at the server-side in order to view the event if you loading the data from the DB. You can refer to the below UG to perform CRUD actions in the Blazor scheduler.
https://blazor.syncfusion.com/documentation/scheduler/data-binding#scheduler-crud-actions
Kindly try the above solution and let us know if this meets your requirement.
Regards,
Ruksar Moosa Sait
Hello,
So I'm back at this issue where the Editor window won't close. I'm using the OnActionBegin and it's going through that code, so data is being updated. But then the editor window just sort of flashes really quick and stays open, I can't get it to close. I've tried ScheduleRef.CloseEditor but nothing, I've even tried to send an args.cancel, since the cancel button will close it but that didn't work either. Any additional help is appreciated.
Thanks,
Andrew
Hi Andrew,
We have created a new forum for the last reported query. We request you to follow the below for further assistance.
https://www.syncfusion.com/forums/174985/how-to-grab-data-from-editor-window-from-forum-171743
Regards,
Ruksar Moosa Sait