Class MoreMotionAjaxManager
Object
|
+--MoreMotionAjaxManager
- class
MoreMotionAjaxManager
Manager Class that provides static methods for Ajax functionalities. A static object of this class
is avaialable with name AjaxMgr
.
var AjaxMgr = new MoreMotionAjaxManager();
Defined in Ajax.js
Method Summary |
void
|
cancelRequest(controlId)
Cancels the previously sent request with the specified controlId
|
void
|
clearOptions(elmid, soq)
Clears the options of an HTML SELECT Element.
|
void
|
customRefresh(prm)
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the AjaxActionService on the server.
|
Object
|
executeAjaxCommand(prm)
Executes the specified Ajax Command on the server.
|
void
|
refreshAreas(prm)
Refreshes only a part or parts of a page without making a new request for the whole page.
|
void
|
refreshBlocks(prm)
Refreshes the records of the specified ProcessBlock elements in the current page.
|
void
|
refreshFields(prm)
Refreshes the values of HTML Elements or ProcessField objects.
|
void
|
refreshOptions(prm)
Refreshes the options of an HTML SELECT Element with the current data acquired
from a MoreMotion Data Source.
|
boolean
|
submitProcessForm(prm)
Prepares an Ajax request out of the specified process form and submits it as an XMLHtttpRequest.
|
void
|
viewState(prm)
This method is used to store/retrieve states of browser user controls to/from MoreMotion Page Variables on the server
with XMLHttpRequest
|
MoreMotionAjaxManager
MoreMotionAjaxManager()
cancelRequest
void cancelRequest(controlId)
Cancels the previously sent request with the specified controlId
Parameters:
controlId
- The control Id of the request to cancel
clearOptions
void clearOptions(elmid, soq)
Clears the options of an HTML SELECT
Element.
Parameters:
elmid
- The id of the SELECT
Element (ComboBox or ListBox)
soq
- Static Options Quantity. The number of the options on the top of the list that should be preserved while clearing the others.
customRefresh
void customRefresh(prm)
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the AjaxActionService on the server.
Parameters:
prm
- The parameters object. The AjaxActionService class invokes the configured data service and prepares an AjaxResponse out of the ADOM prepared by it. The AjaxResponse received from the service should be handled by a custom handler function. - prm.actionName - The name of the
actionParams
configuration element in the MoreMotion configuration. - prm.requestParams - The request parameters. It can be a single String in
'p1=p1val&p2=p2val'
form or a properties object in {p1:'p1val',p2:this.value}
form - prm.responseHandler - The Javascript function that is responsible for handling the response. The function receives AjaxResponse object as the parameter. Note that response handler can also be specified in action configuration defined with
prm.actionName
property. - prm.userData - The user propertis object to store user data.
- prm.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- prm.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- prm.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
Example:
AjaxMgr.customRefresh({
actionName : 'RefreshModelNames'
,requestParams : 'CAT=' + this.value
});
<actionParams name="RefreshModelNames">
<dataSource>model_names</dataSource>
<nodesToEncrypt>ID</nodesToEncrypt>
<responseHandler>MyResponseHandler</responseHandler>
</actionParams>
executeAjaxCommand
Object executeAjaxCommand(prm)
Executes the specified Ajax Command on the server.
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the MoreMotion Ajax Service
on the server.
Parameters:
prm
- The parameter object - prm.commandName - The name of the ajaxProcessCommand configuration element.
- prm.requestParams - The request parameters. It can be a single String in
'p1=p1val&p2=p2val'
form or a properties object in {p1:'p1val',p2:this.value}
form - prm.callbackFunc - The Javascript function to be called after the target elements are refreshed. The function receives MultiPartAjaxResponse object as the parameter.
- prm.userData - The user propertis object to store user data.
- prm.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- prm.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- prm.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
- prm.originNode - The handle of the DOM Node that originates this request. This parameter should be supplied only if the call is made from a DOM node that was fetched with a refreshAreas() method call. It is required to access to the enclosing node that contains a
mo:pageInfo
attribute.
Example:
AjaxMgr.executeAjaxCommand({
commandName : 'CartProds',
requestParams : 'CAT=' + category,
busyImage : 'bimg1'
});
refreshAreas
void refreshAreas(prm)
Refreshes only a part or parts of a page without making a new request for the whole page.
For the page parts to be refreshed in the page, the "TargetArea" or "RefreshableArea" elements should be used.
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the MoreMotion Ajax Service
on the server.
Parameters:
prm
- The parameter object - prm.actionName - The name of the
actionParams
configuration element in the MoreMotion configuration. - prm.targetAreas - Target Areas to be refreshed in the current page. It can be a single String that contains the HTML ids of the target elements separated with commas or an Array of target elements.
- prm.requestParams - The request parameters. It can be a single String in
'p1=p1val&p2=p2val'
form or a properties object in {p1:'p1val',p2:this.value}
form - prm.callbackFunc - The Javascript function to be called after the target elements are refreshed. The function receives MultiPartAjaxResponse object as the parameter.
- prm.userData - The user propertis object to store user data.
- prm.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- prm.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- prm.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
- prm.originNode - The handle of the DOM Node that originates this request. This parameter should be supplied only if the call is made from a DOM node that was fetched with a refreshAreas() method call. It is required to access to the enclosing node that contains a
mo:pageInfo
attribute.
Example:
AjaxMgr.refreshAreas({
actionName : '/RefreshDetails'
,targetAreas : 'Details'
,requestParams : 'CAT=' + category
,busyImage : 'bimg1'
});
Configuration:
<actionParams name="RefreshDetails">
<sourceAreas>/AjaxSourcePage1.Details</sourceAreas>
</actionParams>
refreshBlocks
void refreshBlocks(prm)
Refreshes the records of the specified ProcessBlock elements in the current page.
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the MoreMotion Ajax Service
on the server.
Parameters:
prm
- The parameters object. - prm.actionName - The name of the
actionParams
configuration element in the MoreMotion configuration. - prm.targetBlocks - Target blocks elements to refresh. It can be a single String that contains the HTML ids of the target elements separated with commas or an Array of elements.
- prm.fieldMap - By default, the values of the process fields in the specified process blocks are refreshed with the values of the identically named data nodes. If there are exceptions to this rule it can be specified with this parameter in
processFieldName:dataNodeName,[processFieldName:dataNodeName ...]
format.
Example: ORDER_ID:ID,UNIT_PRICE:PRICE
- prm.requestParams - The request parameters. It can be a single String in
'p1=p1val&p2=p2val'
form or a properties object in {p1:'p1val',p2:this.value}
form - prm.callbackFunc - The Javascript function to be called after the target elements are refreshed. The function receives MultiPartAjaxResponse object as the parameter.
- prm.userData - The user propertis object to store user data.
- prm.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- prm.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- prm.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
Example:
AjaxMgr.refreshBlocks({
actionName : 'RefreshFormRecords'
,targetBlocks : 'PF1.ProductsPB,PF2.Customers'
,requestParams : 'ID=' + this.value
});
Configuration:
<actionParams name="RefreshFormRecords">
<dataSources>products,customers</dataSources>
<nodesToEncrypt>ID</nodesToEncrypt>
</actionParams>
refreshFields
void refreshFields(prm)
Refreshes the values of HTML Elements or ProcessField objects. This method utilizes the
AjaxRequest class to send a XMLHttpRequest to the MoreMotion Ajax Service on the server.
Parameters:
prm
- The parameters object. - prm.actionName - The name of the
actionParams
configuration element in the MoreMotion configuration. - prm.targetElements - Target HTML elements or Process Fields to refresh. It can be a single String that contains the HTML ids of the elements separated with commas or an Array of elements.
- prm.targetElementAttrs - A String that contains the names of the attributes of the target elements, separated with commas, to set. If omitted "value" attributes of the target elements are set. Note that the definitions should positionally correspond to the elements defined in targetElements property.
- prm.dataNodes - The names of the Data Nodes existing in the result record to take the values for the target elements. If this parameter is omitted it is assumed that the names of the data nodes are identical to the target element names.
Note that some target process fields require more than one data nodes, e.g. SuggestBox. In that case data node names must be separated with "/" character.
Example: NAME/ID,STOCK,PRICE
- prm.requestParams - The request parameters. It can be a single String in
'p1=p1val&p2=p2val'
form or a properties object in {p1:'p1val',p2:this.value}
form - prm.callbackFunc - The Javascript function to be called after the target elements are refreshed. The function receives MultiPartAjaxResponse object as the parameter.
- prm.userData - The user propertis object to store user data.
- prm.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- prm.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- prm.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
Example:
AjaxMgr.refreshFields({
actionName : 'RefreshProductFields'
,dataNodes : 'NAME/ID,STOCK,PRICE'
,targetElements : 'PROD_SBOX,STOCK,PRICE'
,requestParams : 'ID=' + this.value
});
Configuration:
<actionParams name="RefreshProductFields">
<dataSource>product_details</dataSource>
<nodesToEncrypt></nodesToEncrypt>
</actionParams>
refreshOptions
void refreshOptions(prm)
Refreshes the options of an HTML SELECT
Element with the current data acquired
from a MoreMotion Data Source.
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the MoreMotion Ajax Service
on the server.
Parameters:
prm
- The parameters object - prm.actionName - The name of the
actionParams
configuration element in the MoreMotion configuration. - prm.optionNode - The Name of the data node in the datasource that will provide the text of each option
- prm.valueNode - The Name of the data node in the datasource that will provide the value of each option
- prm.staticOptionsQty - Static Options Quantity. The number of the options on the top of the list that should be preserved while refreshing the others.
- prm.targetElement - The id or the object itself of the
SELECT
Element (ComboBox or ListBox) - prm.requestParams - The request parameters. It can be a single String in
'p1=p1val&p2=p2val'
form or a properties object in {p1:'p1val',p2:this.value}
form - prm.callbackFunc - The Javascript function to be called after the target
SELECT
Element is refreshed. The function receives MultiPartAjaxResponse object as the parameter. - prm.userData - The user propertis object to store user data.
- prm.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- prm.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- prm.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
Example:
AjaxMgr.refreshOptions({
actionName : 'RefreshCities'
,optionNode : 'NAME'
,valueNode : 'ID'
,targetElement : 'x123'
,requestParams : 'CAT=' + this.value
});
Configuration:
<actionParams name="RefreshCities">
<dataSource>cities_of_country</dataSource>
<valueNode>ID</valueNode>
<encryptTheValue>true</encryptTheValue>
</actionParams>
submitProcessForm
boolean submitProcessForm(prm)
Prepares an Ajax request out of the specified process form and submits it as an XMLHtttpRequest.
Parameters:
prm
- The Parameters Object - prm.formName - The name of the ProcessForm
- prm.commandName The name of the ProcessCommand
- prm.requiredBlocks The names of the blocks (separated with commas) to be validated before submitting the form.
- prm.beforeSubmitFunc The name of the javascript function to be called before the request is submitted. The function receives ProcessForm object and the command name.
- prm.validateInput Flag that denotes that Field validations should be performed or not.
- prm.confirmMessage The confirmation message text to be prompted to the user.
- prm.busyImage - The Html Id of the object itself of the image element to be used as the busy image. This image will be displayed on the page until the response is received from the server and processed.
- prm.requestParams - The request parameters. It can be a single String in
'p1=p1val&p2=p2val'
form or a properties object in {p1:'p1val',p2:this.value}
form - prm.callbackFunc - The Javascript function to be called after the target
SELECT
Element is refreshed. The function receives MultiPartAjaxResponse object as the parameter. - prm.userData - The user propertis object to store user data.
- prm.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- prm.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- prm.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
Note: Parameters requiredBlocks, beforeSubmitFunc, validateInput, confirmMessage
and busyImage
can also be defined in the mo:props
attribute of a ProcessCommand element. If that is the case these parameters can be omitted here.
Example:
AjaxMgr.submitProcessForm({
formName : 'PF1'
,commandName : 'Delete'
,requestParams : 'CAT=' + this.value
,busyImage : 'Busy1'
});
Returns:
true
if form is submitted false
if submittion is cancelled because of a validation error.
viewState
void viewState(prm)
This method is used to store/retrieve states of browser user controls to/from MoreMotion Page Variables on the server
with XMLHttpRequest
Parameters:
prm
- The parameter object - prm.getVars - String that contains the names of the ViewState variables (Separated with commas) to retrieve from MoreMotion.
- prm.setVars - The property object that contains the names and the values of the ViewState variables to let MoreMotion to store them.
- prm.callbackFunc - The Javascript function to be called after the response to XMLHttpRequest is received. The function receives the properties object as the first parameter that contains the ViewState variables retrieved from MoreMotion and the data object as the second parameter.
- prm.userData - The user propertis object to store user data.
- prm.originNode - The handle of the DOM Node that originates this request. This parameter should be supplied only if the call is made from a DOM node that was fetched with a refreshAreas() method call. It is required to access to the enclosing node that contains a
mo:pageInfo
attribute.
Example:
AjaxMgr.viewState({
getVars : 'ScrollPosition,SliderIsOpen',
callbackFunc : function(vars) {alert(vars.ScrollPosition + " " + vars.SliderIsOpen)}
});
AjaxMgr.viewState({
setVars : {ScroolPosition:1, SliderIsOpen:document.getElementById('x123').checked}
});
Copyright 2002 - 2008, MOR YAZILIM
Documentation generated by
JSDoc on Mon Sep 29 14:52:55 2008