Load data remote by Axios.get?

Hi, can you guide me?
Biểu tượng Cộng đồng đã xác minh


1 Reply 1 reply marked as answer

HB Hareesh Balasubramanian Syncfusion Team May 25, 2021 09:26 AM UTC

Hi Minh, 

Greetings from Syncfusion Support..! 

We have validated your shared query and suspect that your requirement is to “load remote data to scheduler”. We have prepared a sample using axios.get() for your reference which can be viewed from the following link.  

  componentDidMount() { 
    axios 
      .get( 
        'https://ej2services.syncfusion.com/production/web-services/api/Schedule' 
      ) 
      .then(({ data }) => { 
        var schObj = document.querySelector('.e-schedule').ej2_instances[0]; 
        schObj.eventSettings.dataSource = data; 
      }); 
  } 

Also we have prepared a sample using our own Ajax call to load the remote events for the Scheduler, which can be viewed from the following link. 


  btnClick() { 
    var ajax = new Ajax( 
      'https://ej2services.syncfusion.com/production/web-services/api/Schedule', 
      'GET', 
      false 
    ); 
    ajax.onSuccess = function(value) { 
      var schObj = document.querySelector('.e-schedule').ej2_instances[0]; 
      schObj.eventSettings.dataSource = JSON.parse(value); 
    }; 
    ajax.send(); 
  } 

Note: We are not able to view your attached image in the last post. 

Regards, 
Hareesh 


Marked as answer
Loader.
Up arrow icon