load Method

Description

Loads an existing drawing into the Web SDK editor.

Syntax

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

Parameters

drawingData: String

The load method will load three types of diagrams into the Web SDK editor:

  1. SVG-format diagrams created in the Web SDK editor and stored via the store method of the editor.
  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 Trancite'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 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 Web SDK 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, an Error object. This function will be called if the load fails. The passed Error object indicates the nature of the failure. This function may return true to indicate that the error has been handled. If the function does not return true, 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);