load Method

Description

Loads an existing drawing into the ESD/SPD Web editor.

Syntax

.load(/* String */ drawingData, /* Function */ onSuccess, /* Function */ onError)

Parameters

drawingData: String

The load method will load three types of diagrams into the ESD/SPD Web editor:

  1. SVG-format diagrams created in the ESD/SPD Web editor and stored via the editor's store method.
  2. Legacy diagrams created in the Easy Street Draw and ScenePD ActiveX controls and stored using their StoreToString method.
  3. Legacy diagrams created in any of PAE's desktop diagramming solutions: Easy Street Draw, ScenePD, FireScene, Signature Scene, DCT or ATTAC. The file content must be in the data-URL format. This format is provided by the browser's FileReader.readAsDataURL function.

Note: When a legacy diagram or file is loaded, there will be a short delay while the editor converts the legacy data to the format required by the ESD/SPD Web editor. If the diagram file contains multiple diagrams, only the first diagram will be loaded. After conversion, a subsequent call to the store method will retrieve the diagram in the SVG diagram format.

onSuccess: Function

A function with no parameters. This function will be called when the diagram has been loaded successfully.

onError: Function

A function that accepts one parameter, a JavaScript Error object. This function will be called if the export fails. An Error object indicating the nature of the failure will be passed to it. If this function does not return true, indicating that the error has been handled, the error will be passed on to the built-in error handler.

Example

/* This example assumes that editor is an initialized ESDWeb object */

function onSuccess() {
	// The load was successful...
    // Any operations that depend on the loaded diagram must
    // be done within the body of this callback function.
}

function onError(error) {
	alert('Diagram load failed' + error.message);
}

// diagramData contains a diagram in SVG or legacy string format.
editor.load(diagramData, onSuccess, onError);