load

loads data from an external file

promise load(string url,string type);

Parameters

urlstringthe URL of an external file
typestringoptional, type of data (json, csv, xml), json by default

Returns

promisea promise of data loading

Example

diagram.data.load("../common/data.xml", "xml");

Related samples

Details

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:

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

or

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