Content

JavaScript API for ELN/LES Worksheets

Worksheet Manager Context

Global Context

 
 

 

 

 

JavaScript API for ELN/LES Worksheets

Top../images/arwup.gif (846 bytes)

The JavaScript methods described below are not exposed in a *.js file. They are dynamically generated and mapped onto functionality provided by Google Web Tools.

Worksheet Manager Context

 

The following JavaScript API methods are available within the context of the Worksheet Manager. As such, they can be used to perform operations specific to Worksheet Manager content (such as in buttons defined by Operations of Type "Custom" and Control editor JavaScript files).

These method are called on the sapphire.worksheet object.

Method Description
getConfigProperty ( propertyid, callback ) Returns a configuration property of the current Control via a callback function. Only simple properties are supported, i.e., PropertyList or Collection cannot be returned with this method.
PropertyDescription
propertyid Name of the property.
callback JS method to call with the property value (returned as the first and only argument).
setConfigProperty ( propertyid, propertyvalue, refresh ) Sets a configuration property of the current Control.
PropertyDescription
propertyid Name of the property.
propertyvalueNew value for the property.
refreshBoolean to determine if the Control should be refreshed after the property is set.
getConfigProperties ( callback ) Returns all configuration properties of the current Control via a callback function.
PropertyDescription
callbackJS method to call with the properties in a JSON string format (returned as the first and only argument).
sapphire.worksheet.setConfigProperties ( jsonprops, merge, refresh ) Sets all configuration properties for the current Control.
PropertyDescription
jsonpropsJSON string representation of the new properties.
mergeBoolean to determine if the properties should be merged or overwritten.
refreshBoolean to determine if the Control should be refreshed after the property is set.
getCurrentType () Returns the currently selected type (W=Worksheet, S=Section, I=Control).
getCurrentId () Returns the currently selected id. Depending on the type, this will be a worksheetid, sectionid or worksheetitemid.
getCurrentVersion () Returns the currently selected version. Depending on the type, this will be a worksheetversionid, sectionversionid or worksheetitemversionid.
getWorksheetManagerWidth () Returns the Worksheet Manager width in px.
getWorksheetManagerHeight () Returns the Worksheet Manager height in px.
getWorksheetPanelWidth () Returns the Worksheet Panel width (the middle Panel containing the Worksheet, excluding the ToC and details) in px.
getWorksheetPanelHeight () Returns the Worksheet Panel height (the middle Panel containing the Worksheet, excluding the ToC and details) in px.
addReference ( refworksheetid, refworksheetversionid, refid, refversion, reftype, reffunction, refresh ) Adds a reference to the current Control (these are shown in the Show References dialog),
PropertyDescription
refworksheetidReferenced Worksheet.
refworksheetversionidReferenced Worksheet version.
refidReferenced Section/Control.
refversionReferenced Section/Control version.
reftypeType of reference (S=Section, I=Control).
reffunction Reference function:
ValueDescription
linkProvides a reference to the Section/Control. Display may vary if the referenced Section/Control changes.
includeIncludes a copy of the referenced Section/Control. Display is not affected by changes in the referenced Section/Control.
selectWorksheetItem ( worksheetid, worksheetversionid, callback ) Allows a user to select a section or control from a worksheet
PropertyDescription
worksheetidWorksheet from which to select.
worksheetversionidWorksheet version from which to select.
callback JS method to call with the selected Section or Control. Return arguments are:
Return ArgDescription
worksheetidSelected Worksheet.
worksheetversionidSelected Worksheet version.
idSelected Section or Control.
versionSelected Section or Control version.
typeSelected type (S=Section, I=Control).
copyBoolean denoting if the Copy checkbox was selected on the selection dialog.
scrollToTop ( setfocus ) Scrolls to the top of the Worksheet.
PropertyDescription
setfocusBoolean that determines if the top item assumes focus.
scrollToBottom ( setfocus ) Scrolls to the bottom of the Worksheet.
PropertyDescription
setfocusBoolean that determines if the bottom item assumes focus.
setCurrentWorksheetItem ( worksheetitemid, worksheetitemversionid ) Sets/selects the current Worksheet item (title, Section or Control).
PropertyDescription
worksheetitemidId of the item to select.
worksheetitemversionidVersion of the item to select.
refresh () Refreshes the current Control.
refreshSection () Refreshes the current Section, i.e., all Controls in the current Section.
refreshWorksheet () Refreshes/reloads the Worksheet.

 

Global Context

 

The following JavaScript API methods are available globally. They are currently used from the various control, worksheet and workbook pages.

These method are called on the sapphire.worksheet object.

Method Description
addWorksheet ( workbookid, workbookversionid, createCallback ) Displays the Add Worksheet dialog to allow a new Worksheet to be created.
PropertyDescription
workbookid Default Workbook to which the Worksheet is added.
workbookversionidDefault Workbook version to which the Worksheet is added.
createcallbackJS method to call when the Worksheet has been added. This returns a single argument with the following items concatenated together: workbookid, workbookversionid, worksheetid, worksheetversionid, and worksheetname.
copyWorksheet ( worksheetid, worksheetversionid, copyCallback ) Displays the Copy Worksheet dialog to allow an existing worksheet to be copied.
PropertyDescription
worksheetid Worksheet to copy.
worksheetversionidWorksheet version to copy.
copycallbackJS method to call when the worksheet has been copied. This returns a single argument with the following items concatenated together: workbookid, workbookversionid, worksheetid, worksheetversionid, and worksheetname.
addTemplate ( templateprivacyflag, createCallback ) Displays the Add Worksheet Template dialog to create a new Worksheet Template.
PropertyDescription
templateprivacyflag Denotes who can open/use the Template (G = Global, O = Owner).
createcallbackJS method to call when the Worksheet Template has been created. This returns a single argument with the following items concatenated together: worksheetid, worksheetversionid, and worksheetname.
addControlTemplate ( templateprivacyflag, createCallback ) Displays the Add Control Template dialog to create a new Control Template.
PropertyDescription
templateprivacyflag Denotes who can open/use the Template (G = Global, O = Owner).
createcallbackJS method to call when the Control Template has been created. This returns a single argument with the following items concatenated together: worksheetid, worksheetversionid, and worksheetname.
copyTemplate ( worksheetid, worksheetversionid, worksheetname, templateprivacyflag, copyCallback ) Displays the Copy Worksheet Template dialog to copy an existing Worksheet Template.
PropertyDescription
templateprivacyflag Denotes who can open/use the Template (G = Global, O = Owner).
copycallbackJS method to call when the Worksheet Template has been copied. This returns a single argument with the following items concatenated together: worksheetid, worksheetversionid, and worksheetname.
copyControlTemplate ( worksheetid, worksheetversionid, worksheetname, templateprivacyflag, copyCallback ) Displays the Copy Control Template dialog to copy an existing Control Template.
PropertyDescription
templateprivacyflag Denotes who can open/use the Template (G = Global, O = Owner).
copycallback JS method to call when the Control Template has been copied. This returns a single argument with the following items concatenated together: worksheetid, worksheetversionid, and worksheetname.
saveAsGlobal ( worksheetid, worksheetversionid, worksheetname, templatetype ) Displays the Save As Global dialog to save an existing Worksheet or Control Template as a Global Template.
PropertyDescription
worksheetid Worksheet/Control Template.
worksheetversionidWorksheet/Control Template version.
worksheetnameWorksheet/Control Template name.
templatetypeType of Template (W=Worksheet;I=Control).