BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hello,
How would I go about setting defaults for the items circled in red in the attached picture? Passing a recurrence rule doesn't seem to work.
I have the class below - creating a new instance of the class and filling in the defaults and then calling OpenEditorAsync works perfectly except for the recurrencerule which is ignored. I pass
"FREQ=MONTHLY;INTERVAL=1;BYDAY=MO;BYSETPOS=4;"
As the recurrence rule but the editor still opens with Repeat: Never, the other repeat values are defaults as well. How do I make the editor open with the correct
public class AppointmentData
{
public int? Id { get; set; }
public string? Subject { get; set; }
public string? Location { get; set; } = "";
public string? Description { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public bool IsAllDay { get; set; }
public string? RecurrenceRule { get; set; }
public int? RecurrenceId { get; set; }
public string? RecurrenceException { get; set; }
public string? StartTimeZone { get; set; }
public string? EndTimeZone { get; set; }
}
Hi Sheldon,
Ug: https://blazor.syncfusion.com/documentation/scheduler/events#oncelldoubleclick
Below is a sample code to open the editor with the default recurrence rule using OpenEditorAsync. When passing the eventData parameter to OpenEditorAsync, ensure to provide a value in the RecurrenceRule field to open the editor with the default recurrence value.
[index.razor]
@code { public async Task OnCellDoubleClick(CellClickEventArgs args) { args.Cancel = true; var ActiveCellsData = await ScheduleRef.GetTargetCellAsync((int)args.MouseEventArgs.ScreenX, (int)args.MouseEventArgs.ScreenY); AppointmentData eventData = new AppointmentData { Id = await ScheduleRef.GetMaxEventIdAsync<int>(), Subject = "Add title", StartTime = ActiveCellsData.StartTime, EndTime = ActiveCellsData.StartTime.AddHours(1), Location = "", Description = "", IsAllDay = false, RecurrenceRule = "FREQ=MONTHLY;BYDAY=MO;BYSETPOS=4;INTERVAL=1" }; await ScheduleRef.OpenEditorAsync(eventData, CurrentAction.Add); } |
Regards,
Vijay Ravi
Hello,
Your zip sample will not load into VS2022 - see pic below with the error
So, when I tried to use your sample code from above 2 thing happened.
Id = await ScheduleRef.GetMaxEventIdAsync<int>() hangs forever - I suspect because there were no existing appointments.
So I took that out and just hard coded a 1 for the Id and then filling in the recurrence rule doesn't work - which was my original point.
Thanks
Sheldon
Hi Sheldon,
You can resolve your reported problem by removing the Id field in the eventData when you call the OpenEditoryAsync method to add a new appointment as shown in the below code snippet. Try the shared sample and if you still facing issues share the below details to proceed further.
[index.cshtml]
<SfSchedule TValue="AppointmentData" @ref="@ScheduleRef" Height="650px" @bind-SelectedDate="@CurrentDate"> <ScheduleEvents TValue="AppointmentData" OnCellDoubleClick="OnCellDoubleClick"></ScheduleEvents> </SfSchedule> @code { public async Task OnCellDoubleClick(CellClickEventArgs args) { args.Cancel = true; AppointmentData eventData = new AppointmentData { Subject = "Add title", StartTime = args.StartTime, EndTime = args.StartTime.AddHours(1), Location = "", Description = "", IsAllDay = args.IsAllDay, RecurrenceRule = "FREQ=MONTHLY;BYDAY=MO;BYSETPOS=4;INTERVAL=1" }; await ScheduleRef.OpenEditorAsync(eventData, CurrentAction.Add); } |
Regards,
Vijay Ravi
In your sample if you change the ReccurenceRule to FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=1; you will see it comes up incorrectly. This should be repeat on the 1st every 2 months but comes up as:
You can try and resave it by clicking Day and then opening it and it will be wrong again.
Also in your demo ( as well as my app ), if you save the recurring event and then try Edit Event ( Edit Series works fine ) it crashes
Hi Sheldon,
In your shared code snippet, you are using the Id field of the appointment as nullable which is causing your reported problem. It’s mandatory that each appointment needs to have a unique Id value. So, you can resolve your reported problem by changing the Id type from nullable int to int as highlighted in the below code snippet.
[index.cshtml]
public class AppointmentData { public int Id { get; set; } } |
Regards,
Vijay Ravi
The example you sent me has Id as nullable :) But that does fix the crash. It doesn't fix the fact that saving a recurring event and editing it is being parsed incorrectly. See the top of my previous message. Or just try it in your own sample. Add an event, set it to recur on the first day of every month, save it, edit the series and it will not be what you set it to.
Sheldon
Hi Sheldon
We confirmed your reported problem with "RecurrenceRule comes up incorrectly" as a bug and logged the defect report. The fix for this defect will be included in our upcoming weekly patch release, which is expected to be rolled out on 25th April. You can track the status of the fix at the following link:
Disclaimer: The inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
Regards,
Vijay Ravi
Hi Sheldon,
The fix for the issue “RecurrenceRule comes up incorrectly” has been included in our weekly release 21.1.41. Upgrade to the latest version to resolve the issue.
Release notes: https://blazor.syncfusion.com/documentation/release-notes/21.1.41?type=all#schedule
Regards,
Vinitha