Force reload/refresh of resources in a scheduler

How do we force reload/refresh resources in a scheduler?  _schedule.RefreshEventsAsync() does not refresh resource data. Is there a _scheduleResource.RefreshDataAsync()?

        <SfSchedule @ref="_schedule">

            <ScheduleResources>

                <ScheduleResource @ref="_scheduleResource"  TItem="Room" TValue="int?" Field="RoomId" Title="Room" Name="Rooms" TextField="Text" IdField="Id" AllowMultiple="false">

                    <SfDataManager Url="/api/Room" Adaptor="Adaptors.UrlAdaptor"></SfDataManager>

                </ScheduleResource>

            </ScheduleResources>

        </SfSchedule>




9 Replies

RM Ruksar Moosa Sait Syncfusion Team October 4, 2022 04:14 PM UTC

Hi Patrick,


We have checked on your requirement and suggest you to call StateHasChanged() method once the resources have loaded in the scheduler in order to refresh the resources. Kindly try the solution and if the issue persists, then you can force reload the scheduler on a button click using the uriHelper class like the below code.


uriHelper.NavigateTo(uriHelper.Uri, forceLoad: true);


https://www.syncfusion.com/faq/blazor/general/how-do-i-force-page-reload-or-refresh-in-blazor#:~:text=A%20page%20is%20reloaded%2Frefreshed,browser%20based%20on%20the%20URI


Regards,

Ruksar Moosa Sait



PL patrick lo, October 4, 2022 05:17 PM UTC

Hi Ruksar,


I confirmed that calling StateHasChanged() does not refresh the resources. 


I have other controls on the same page (e.g. textbox, pager, dialog, etc) that I would like to keep their state. Calling uriHelper.NavigateTo(uriHelper.Uri, forceLoad: true);   reloads the page and forces other controls to loss their state.  Please advice.


Regards,

Patrick



RM Ruksar Moosa Sait Syncfusion Team October 5, 2022 09:42 AM UTC

Hi Patrick,


We have checked on your query and let you know that we do not have direct options like RefreshEventAsync to refresh the resource data. Hence we suggest you trigger the RemoveResource public method by passing null parameters to it on a button click to refresh only the Scheduler Resources after it is loaded in the scheduler. We have prepared a sample for your reference. Kindly try the attached sample and let us know if this meets your requirement


[ResourceAdaptopMultiLevel.razor]

public void OnClick()

{

   ScheduleRef.RemoveResource<ResourceData>(null, null);           

}


Regards,

Ruksar Moosa Sait


Attachment: BlazorResourceAdaptors_53268b31.zip


PL patrick lo, October 5, 2022 03:46 PM UTC

Dear Ruksar,


I refer to your sample on multiadaptor. I have made some modification to ResourceList and LastResourceList. On button click, how do I make scheduler reflect the correct text? e.g. DateTime.Now.TimeOfDay.  





RM Ruksar Moosa Sait Syncfusion Team October 6, 2022 10:38 AM UTC

Hi Patrick,


We have checked on your query and suggest you to bind @Key value to the scheduler to increment it on a button click and define the ResourceData in the ReadAsync method like the below code to achieve your requirement.


<SfSchedule @ref="ScheduleRef" @key="ScheduleKey" TValue="EventData" Width="100%" Height="650px" @bind-CurrentView="CurrentView" @bind-SelectedDate="CurrentDate">


public int ScheduleKey = 1;

public void OnClick()

    {

        ScheduleKey = ScheduleKey + 1;

    }

public class CustomAdaptor : DataAdaptor

    {

        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<ResourceData> EventData = ResourceList();

            return dataManagerRequest.RequiresCounts ? new DataResult() { Result = EventData, Count = EventData.Count() } : (object)EventData;

        }

    }

    public class CustomAdaptor1 : DataAdaptor

    {

        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<LastLevel> EventData = LastResourceList();

            return dataManagerRequest.RequiresCounts ? new DataResult() { Result = EventData, Count = EventData.Count() } : (object)EventData;

        }

    }


Output:

A screenshot of a computer

Description automatically generated


Kindly try the attached sample and let us know if this meets your requirement.


Regards,

Ruksar Moosa Sait


Attachment: BlazorResourceAdaptorsModified_367a02ad.zip


PL patrick lo, October 6, 2022 05:15 PM UTC

Hi Ruksar,


Yes, this meet my requirement. Thank you for your support.


Regards,

Patrick



VD Vinitha Devi Murugan Syncfusion Team October 7, 2022 05:51 AM UTC

Hi Patrick,


Thanks for your update.

We are happy to hear that our solution fulfilled your requirement.


Please get back to us if you need any further assistance.

Regards,

Vinitha



DA Daniel replied to Ruksar Moosa Sait August 9, 2025 01:07 PM UTC

Hi, changing the key is just a workaround, in other words a "makeshift"
Please create a feature request so we have an UpdateResourcesAsync just like we have it for Events



VR Vijay Ravi Syncfusion Team August 11, 2025 09:50 AM UTC

Hi Daniel,
 

We have reviewed your query and would like to clarify that the Schedule component manages resource layout independently from event rendering. This means that refreshing events asynchronously does not automatically refresh the resources. If you want to refresh the resources, you need to update the resource data source directly.


Don't hesitate to get in touch if you require further help or more information.

Regards,

Vijay


Loader.
Up arrow icon