Skip to main content

load()

loads items from a file

load(url: string | object, driver?: object | string): Promise<any>

Parameters:

  • url: string | DataProxy - the URL of an external file or DataProxy object with the URL configured
  • driver: object | string - optional, DataDriver or type of data ("json", "csv", "xml"), "json" by default

Returns:

A promise of data loading.

Example

toolbar.data.load("[path to this file]/file.xml", "xml");

The component will make an AJAX call and expect the remote URL to provide valid JSON data.

Data loading is asynchronous, so you need to wrap any after-loading code into a promise:

toolbar.data.load(url).then(function(){
//do something after load;
});

or

toolbar.data.load(url);
toolbar.data.loadData.then(function(){
//do something after load;
});
// loadData executes a callback function after an asynchronous
// data loading has completed