Skip to main content

save()

saves changes made in a data collection to the server side

save?: (url: string | IDataProxy) => void;

Parameters:

url: string | IDataProxy - the URL of a server side or DataProxy with the URL configured

Example

diagram.data.save("http://userurl/");
//ordiagram.data.save(new DataProxy({url:"http://userurl/"}));

The component will make an AJAX call and expect the remote URL to save data changes.

Data saving is asynchronous, so you need to return a promise - the result of the saving operation. To do this, use the saveData property that returns a "promise" object:

var data = new DataCollection();data.save(loader);return data.saveData.then(function () {    // now your data is saved});

Use the isSaved method to know whether the changes are saved:

diagram.data.saveData.then(function () {    console.log(diagram.data.isSaved());});