How to add local data using the custom adaptor in blazor Scheduler

Answer:

We can access the following as Id and ApiLibrary by using CustomAdaptor as a separate component. Refer to the below code for that.

~/Index.razor

~/ScheduleDataAdaptor.razor

@using static BlazorApp1.Pages.Index;

@inherits DataAdaptor // Need to inherits the service to get the data

@ChildContent

@code {

[Parameter]

[JsonIgnore]

public RenderFragment ChildContent { get; set; }

[Parameter]

public int Id { get; set; }

public async override Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)

{

await Task.Delay(100); //To mimic asynchronous operation, we delayed this operation using Task.Delay

List Datasource = Service.GetAppointments(); // Get data from Service

var id = Id; // Get the id which was passed as a parameter

}


It is essential to define the service class for reference in ~/startup.cs file as like below.

public void ConfigureServices(IServiceCollection services)

{

services.AddSyncfusionBlazor();

services.AddRazorPages();

services.AddServerSideBlazor();

services.AddSingleton();

}


Find the sample for adding local data in the custom adaptor in Blazor Schedule from here.

Loader.
Up arrow icon