We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Offline events on network loss


I'm implementing the scheduler as a personal event reminder, I want to use it in a Angular Application working offline some time, I wondered using Angular services, and observables in order to retrieve events, and making the CRUD, because I can control the request and response in case of loss of internet connectivity and return the localStorage data if any.

Can you help me?

I'm trying to override a DataAdaptor, catching the processResponse method, but this method it's only called when the response was successful, how can I return a fixed response if the request fails?

I tried overriding beforeSend, and creating anonymous function in request.onerror, I catch the error, but I don't know how to return the event data to the control.

class CustomAdaptor extends WebApiAdaptor {
processResponse(data: DataResult, ds?: DataOptions, query?: Query, xhr?: XMLHttpRequest, request?: Ajax, changes?: CrudOptions): Object {
return super.processResponse(data, ds, query, xhr, request, changes);

beforeSend(dm: DataManager, request: XMLHttpRequest, settings: Ajax)
request.onerror = function () {
console.log("--Error Request--");
//Here i want to return event data to the Adaptor --> Scheduler event
let localData = [{Id:1, Subject: "Subject 1", StartTime: new Date(), EndTime: new Date()}]

super.beforeSend(dm, request, settings);

1 Reply

NR Nevitha Ravi Syncfusion Team April 17, 2019 12:54 PM UTC

Hi Eloy, 

Greetings from Syncfusion Support. 

We suspect that your requirement is to assign stored data on network failure and this can be achieved in actionFailure event of scheduler. In the following sample, we have stored the scheduler events in localStorage using dataBinding event. 

  public onDataBinding(e: { [key: string]: Object }): void { 
    localStorage.setItem("scheduleData", JSON.stringify(e.result)); 
  public onActionFailure(): void { 
    this.scheduleObj.eventSettings.dataSource = JSON.parse(localStorage.getItem("scheduleData")); 

Please check whether the solution meets your requirement else share your purpose of achieving the scenario using customAdaptor. 


Live Chat Icon For mobile
Up arrow icon