|
Object: sapphire.ajax |
Description
Creates Ajax requests and handles Ajax responses.
File
WEB-CORE\scripts\sapphirecore.js
Properties
| Property | Type | Value | Behavior |
| defaultToPOST | Boolean | false | Uses GET as the default request method. |
| true | Uses POST as the default request method (this is the default value). |
callClass |
Functionality
Uses Ajax to call a class in LabVantage.
Parameters
| Parameter | Type | Description |
| classname | String | Name of the class to call. |
| callback | Function | JavaScript function called back to. |
| callproperties | Object | Properties to pass to the class. |
| post | Boolean | To post data (rather than get), set to true. Note that post allows more request data to be sent. |
| synchronous | Boolean | Set to true to wait for the request to return (the default is false). |
| errorCallback | String | JavaScript function or code that is executed when an error occurs. If no errorCallback is provided, the default behavior is to show the error in the browser console, not on-screen. To show errors on-screen, define your own errorCallback function to handle the error message returning from the class. |
Returns
None.
callService |
Functionality
Uses Ajax to call an Ajax LabVantage service.
Parameters
| Parameter | Type | Description |
| service | String | Name of the service to call. |
| callback | Function | JavaScript function called back to. |
| callproperties | Object | Properties to pass to the class. |
| post | Boolean | To post data (rather than get), set to true. Note that post allows more request data to be sent. |
| synchronous | Boolean | Set to true to wait for the request to return (the default is false). |
| errorCallback | String | JavaScript function or code that is executed when an error occurs. If no errorCallback is provided, the default behavior is to show the error in the browser console, not on-screen. To show errors on-screen, define your own errorCallback function to handle the error message returning from the service. |
Returns
None.
callCommand |
Functionality
Uses Ajax to call a LabVantage command. The call is triggered after the page has finished loading.
Parameters
| Parameter | Type | Description |
| command | String | Name of the command to call. |
| callback | Function | JavaScript function called back to. |
| callproperties | Object | Properties to pass to the class. |
| post | Boolean | To post data (rather than get), set to true. Note that post allows more request data to be sent. |
| synchronous | Boolean | Set to true to wait for the request to return (the default is false). |
| errorCallback | String | JavaScript function or code that is executed when an error occurs. If no errorCallback is provided, the default behavior is to show the error in the browser console, not on-screen. To show errors on-screen, define your own errorCallback function to handle the error message returning from the command. |
Returns
None.
callServiceError |
Functionality
Functions as an error callback.
Parameters
None.
Returns
None.
callServiceHandler |
Functionality
Handles the Ajax callback.
Parameters
| Parameter | Type | Description |
| type | Object | Type information. |
| data | Object | Returned data. |
| evt | Object | Event from which the handler was fired. |
Returns
None.
request |
| DEPRECATED | Use sapphire.ajax.callClass instead. |
Functionality
Processes an Ajax request.
Parameters
| Parameter | Type | Description |
| requesturl | Stringt | URL of the request. |
| loadhandler | Function | Function to handle load. |
| params | Object | Parameters for Ajax request. |
| formid | String | Id of the form to submit to the request. |
| onerror | Function | Function to call if an error occurs. |
Returns
None.
handleResponse |
Functionality
Handles the Ajax request response.
Parameters
| Parameter | Type | Description |
| type | Object | Type information. |
| data | Object | Returned data. |
| evt | Object | Event from which the handler was fired. |
| params | Object | Parameters that were sent to the request and have been subsequently sent back. |
Returns
None.
handleError |
Functionality
Handles the Ajax request error.
Parameters
None.
Returns
None.
|
Object: sapphire.ajax.io |
Description
Handles AJAX requests. Replaces Dojo.
File
WEB-CORE\scripts\sapphirecore.js
Properties
| Property | Type | Description |
| timeout | Integer | Timeout for the Ajax request (defaults to 60000 ms). After a timeout, the Ajax request is aborted. |
getXMLHttpRequest |
Functionality
Gets the most suitable XMLHTTPRequest object for the browser.
Parameters
None.
Returns
XMLHttpRequest Object.
send |
Functionality
LabVantage Ajax functionality that replaces dojo.bind. This method prepares an Ajax request, sends it, then handles the response.
Parameters
| Parameter | Type | Description |
| sUrl | String | URL for the Ajax request. |
| sMethod | String | Method for the Ajax request (POST or GET, defaults to POST). |
| fOnLoad | Function | Function to execute after a successful response. |
| fOnError | Function | Function to execure after an error response. |
| oForm | Object | Form object to submit to the Ajax request. |
| lSync | Boolean | If true, runs the request synchronously (Sjax). The default is false. |
Returns
None.
|
Object: sapphire.ajax.util |
Description
Utility methods for use in Ajax calls.
File
WEB-CORE\scripts\sapphirecore.js
Properties
None.
getRandomString |
Functionality
Gets a random string of characters. Used to add to a request string to refresh the cache.
Parameters
| Parameter | Type | Description |
| iLength | Integer | Length of the string. |
Returns
String.
createForm |
Functionality
Creates a form object.
Parameters
| Parameter | Type | Description |
| sURL | String | URL for the action. |
| lPost | Boolean | True if post.
False if get. |
| oInputs | Array of Objects | Input properties. |
| oParent | Object | Parent HTML element. Null if not used. |
Returns
Object.
getTimeStamp |
Functionality
Gets an integer time stamp. This is used to pass through Ajax calls (making them unique requests), and allow analysis of request performance.
Parameters
None.
Returns
Integer.
setInnerHTML |
Functionality
Set the innerHTML attribute of an element handling any related style and script. Also evaluates any inline script.
Parameters
| Parameter | Type | Description |
| oContainer | Object | Element into which the HTML is inserted. |
| sHtml | String | HTML content. |
Returns
None.