for some reason when I select week view the scheduler isn't displaying events even though there is a available data returned within the week date range. This is my scheduler definition
<SfSchedule TValue="Appointments.AppointmentData" @bind-CurrentView="@CurrentView" Width="100%" Height="100%" @bind-SelectedDate="@CurrentDate">
<ScheduleViews>
<ScheduleView Option="View.Day"></ScheduleView>
<ScheduleView Option="View.Week"></ScheduleView>
<ScheduleView Option="View.WorkWeek"></ScheduleView>
<ScheduleView Option="View.Month"></ScheduleView>
<ScheduleView Option="View.Agenda"></ScheduleView>
</ScheduleViews>
<ScheduleEventSettings TValue="Appointments.AppointmentData" AllowAdding="false" AllowDeleting="false" AllowEditing ="false">
<SfDataManager AdaptorInstance="@typeof(AppointmentDataAdaptor)" Adaptor="Adaptors.CustomAdaptor">
</SfDataManager>
</ScheduleEventSettings>
</SfSchedule>
and this is the code in my Data Adapter
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)
{
using var tokenSource = new CancellationTokenSource();
var userId = await _identity.GetCurrentUserName();
var CurrentUser = await _userService.GetUserByIdAsync(userId, tokenSource.Token).ConfigureAwait(false);
ApplicationUser = CurrentUser.Result;
IDictionary<string, object> Params = dataManagerRequest.Params;
DateTime start = DateTime.Parse(Params["StartDate"].ToString());
DateTime end = DateTime.Parse(Params["EndDate"].ToString());
var request = new MessageRequest() { StartDate = start, EndDate = end, AgencyId = (long)ApplicationUser.AgencyId, AgencyIdentifier = ApplicationUser.AgencyIdentifier };
var data = await _appService.GetBookingDetailsAsync(request, tokenSource.Token);
EventData = _mapper.Map<IEnumerable<BookingDetailDto>, List<AppointmentData>>(data.Results);
return dataManagerRequest.RequiresCounts ? new DataResult() { Result = EventData, Count = EventData.Count() } : EventData;
}
the code works as expected, If I select Month view I get several dates populated on the scheduler. If I subsequently select week view I get nothing even though there is data available (only one date in this instance)
is this a bug ? I cant see where the problem is, anyone got any insight ?
Hi Mark,
Based on your requirement, we have checked and validated the query for using custom adaptor to render the appointments as rendered as expected we are unable to replicate the issue. Therefore, we kindly request that you provide the following details, as this information will greatly assist us in understanding and resolving the issue effectively.
Github Sample link: https://github.com/SyncfusionExamples/Blazor-Scheduler-CRUD-using-custom-adaptor/tree/master
Custom Adaptor UG: https://blazor.syncfusion.com/documentation/scheduler/data-binding?cs-save-lang=1&cs-lang=razor#load-on-demand
Please get back to us if you need any further assistance
Regards,
Vijay
here are 2 screenshots, you can see there is data in the month view for 27-06-2024, but the same date in week view shows nothing. There are no network or console errors. Data is being returned for the week query. Ive attached the .cs file for the data adapter, unfortunately Im unable to provide a working example as this section is part of a much larger project
Hi Mark,
Can you please check if our shared service runs in your project, and then check the same in your service as well? After comparing, please update us on any differences and the issues occurring on your end. This will make it easier for us to validate your mentioned query on our side. Additionally, we believe you might have missed sharing the data adaptors.cs files.
Service link: https://github.com/SyncfusionExamples/Blazor-Scheduler-CRUD-using-custom-adaptor/tree/master
Please get back to us if you need any further assistance
Regards,
Vijay
Your file upload mechanism allowed me to go through the upload process for the .cs file but it reported a "file type not supported" error so Ive uploaded it as a .zip file
Hi Mark,
We checked and validated your appointmentDataAdapter file. You are using IMapper, IUserIdentityProcessor, and IUserService in your application. Therefore, your service cannot run properly on our end. Can you please check if our shared service runs in your project, and then check the same in your service as well? After comparing, please update us on any differences and the issues occurring on your end. This will make it easier for us to validate your mentioned query on our side.
Please get back to us if you need any further assistance
Regards,
Vijay
I installed your demo and it worked OK. My code worked in exactly the same way as yours but it still wouldn't display data in Week mode. I eventually tracked down the problem, the events on my calendar aren't strictly speaking 'calendar/diary entries' they are dates of performances (but the concept is the same)
These performances can be anywhere from an hour to a full day, so I decided to make the start date & time the same as the end date & time
eg
start 27-06-2024 20:00
end 27-06-2024 20:00
the performances will always be on the same day, its the duration that might vary
the fact that start time & end time are the same was causing the issue, I added 1 hour to the end date/time and it worked as expected every time (week, month & day selection)
Is this by design or is it a bug ?
For my use scenario I may not even know the duration so I couldn't even calculate an end time for every event. Would it be possible to only show the start time on each calendar event ? That would work for me, If so, how would it be done ?
Hi
Mark,
In your application you can set the same StartDate and EndDate. So we suggest you to set the Scheduler minimumEventDuration property in eventSettings to resolve the mentioned issue as shown in the below shared code snippet.
MinimumEventDuration UG: https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Schedule.ScheduleEventSettings-1.html#Syncfusion_Blazor_Schedule_ScheduleEventSettings_1_MinimumEventDuration
[index.razor]
|
<SfSchedule @ref="AvailabilityScheduleRef" TValue="AppointmentData" Width="100%" Height="600px"> <ScheduleViews> <ScheduleView Option="View.Day"></ScheduleView> <ScheduleView Option="View.Week"></ScheduleView> <ScheduleView Option="View.WorkWeek"></ScheduleView> <ScheduleView Option="View.Month"></ScheduleView> <ScheduleView Option="View.Agenda"></ScheduleView> </ScheduleViews> <ScheduleEventSettings TValue="AppointmentData" MinimumEventDuration="30"> <SfDataManager AdaptorInstance="@typeof(AppointmentDataAdaptor)" Adaptor="Adaptors.CustomAdaptor"> </SfDataManager> </ScheduleEventSettings> </SfSchedule> |
please get back to us if you need any further assistance
Regards,
Vijay