Class MoreMotionAjaxManager
Object
|
+--MoreMotionAjaxManager
- class
MoreMotionAjaxManager
Manager Class that provides static methods for Ajax functionalities. A static object of this class
is available 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(props)
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the AjaxActionService on the server.
|
Object
|
executeAjaxCommand(props)
Executes the specified Ajax Command on the server.
|
void
|
executeMScript(props)
Executes MScript codes on the server.
|
Object
|
getEncosingAreaName(node)
|
Object
|
openFlowin(props)
Creates a Floating Window and refreshes the embedded "TargetArea" in it using a "SourceArea".
|
void
|
refreshAreas(props)
Refreshes only a part or parts of a page without making a new request for the whole page.
|
void
|
refreshBlocks(props)
Refreshes the records of the specified ProcessBlock elements in the current page.
|
void
|
refreshFields(props)
Refreshes the values of HTML Elements or ProcessField objects.
|
void
|
refreshOptions(props)
Refreshes the options of an HTML SELECT Element with the current data acquired
from a MoreMotion Data Source.
|
boolean
|
submitProcessForm(props)
Prepares an Ajax request out of the specified process form and submits it as an XMLHtttpRequest.
|
void
|
viewState(props)
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(props)
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the AjaxActionService on the server.
Parameters:
props - 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. - props.actionName - The name of the
actionParams configuration element in the MoreMotion configuration. - props.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 - props.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
props.actionName property. - props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.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(props)
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:
props - The parameter object - props.commandName - The name of the ajaxProcessCommand configuration element.
- props.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 - props.callbackFunc - The Javascript function to be called after a response is received from the server. The function receives MultiPartAjaxResponse object as the parameter.
- props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
- props.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'
});
executeMScript
void executeMScript(props)
Executes MScript codes on the server.
This method is used to execute MScript on the server with XMLHttpRequest. Although MScript can be executed with other
AjaxManager (refresh) methods in many ways, this method is probably the fastest and least expensive one.
Parameters:
props - The parameter object - props.actionName - The name of the
actionParams configuration element in the MoreMotion configuration. - props.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 - props.callbackFunc - The Javascript function to be called after the response to XMLHttpRequest is received. The function receives MultiPartAjaxResponse object as the parameter. Any result field set during the MScript execution can be accessed mpar.getResultField("FIELD_NAME") call in this function.
- props.userData - The user properties object to store user data.
- props.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. - props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
Example:
AjaxMgr.executeMScript({
actionName : 'SetGetVars'
,requestParams : 'TABNAME=T1'
,callbackFunc : RetrieveVars
});
function RetrieveVars(mpar) {
var docroot = mpar.getResultField("DOC_ROOT");
}
Configuration:
<actionParams name="SetGetVars">
<mscript>
@set(s:TABNAME,i:TABNAME)
@setResultField(DOC_ROOT,s:DOC_ROOT)
</mscript>
</actionParams>
getEncosingAreaName
Object getEncosingAreaName(node)
openFlowin
Object openFlowin(props)
Creates a Floating Window and refreshes the embedded "TargetArea" in it using a "SourceArea".
The source area that provide new content should be a "SourceArea" element located in a Ajax Source Page.
This method uses refreshAreas() method call internally.
Parameters:
props - The parameter object - props.name - The name of the flowin and the name of the
actionParams configuration element in the MoreMotion configuration. - props.title - The title of the flowin
- props.width - The width of the flowin
- props.height - The height of the flowin
- props.refElm - The handle of a element in the document to position the flowin relatively. If not specified flowin is centered in the current window.
- props.offsetV - The vertical offset of the flowin in the current window
- props.offsetH - The horizontal offset of the flowin in the current window
- props.skin - The skin name. If not specified, then the default skin is used.
- props.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 - props.callbackFunc - The Javascript function to be called after the floating window is displayed. The function receives MultiPartAjaxResponse object as the parameter.
- props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
- props.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.openFlowin({
name : 'UserInfo'
,title : 'Update User Information'
,width : 300
,height : 200
,refElm : elm
,requestParams : 'USER=' + userId
,busyImage : 'bimg1'
});
Configuration:
<actionParams name="RefreshDetails">
<sourceAreas>/AjaxSourcePage1.Details</sourceAreas>
</actionParams>
refreshAreas
void refreshAreas(props)
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.
The source area(s) that provide new content can either be a "SourceArea" element located in a Ajax Source Page or a "RefreshableArea" located
in the same page. The name of the source areas are specified in the configuration with <actionParams><sourceAreas> elements.
This method utilizes the AjaxRequest class to send a XMLHttpRequest to the MoreMotion Ajax Service
on the server.
Parameters:
props - The parameter object - props.actionName - The name of the
actionParams configuration element in the MoreMotion configuration. - props.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.
- props.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 - props.callbackFunc - The Javascript function to be called after the target areas are refreshed. The function receives MultiPartAjaxResponse object as the parameter.
- props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
- props.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(props)
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:
props - The parameters object. - props.actionName - The name of the
actionParams configuration element in the MoreMotion configuration. - props.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.
- props.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 - props.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 - props.callbackFunc - The Javascript function to be called after the target blocks are refreshed. The function receives MultiPartAjaxResponse object as the parameter.
- props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.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(props)
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:
props - The parameters object. - props.actionName - The name of the
actionParams configuration element in the MoreMotion configuration. - props.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.
- props.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.
- props.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 - props.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 - props.callbackFunc - The Javascript function to be called after the target elements are refreshed. The function receives MultiPartAjaxResponse object as the parameter.
- props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.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(props)
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:
props - The parameters object - props.actionName - The name of the
actionParams configuration element in the MoreMotion configuration. - props.optionNode - The Name of the data node in the data source that will provide the text of each option
- props.valueNode - The Name of the data node in the data source that will provide the value of each option
- props.staticOptionsQty - Static Options Quantity. The number of the options on the top of the list that should be preserved while refreshing the others.
- props.targetElement - The id or the object itself of the
SELECT Element (ComboBox or ListBox) - props.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 - props.callbackFunc - The Javascript function to be called after the target
SELECT Element is refreshed. The function receives MultiPartAjaxResponse object as the parameter. - props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.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(props)
Prepares an Ajax request out of the specified process form and submits it as an XMLHtttpRequest.
Parameters:
props - The Parameters Object - props.formName - The name of the ProcessForm
- props.commandName The name of the ProcessCommand
- props.requiredBlocks The names of the blocks (separated with commas) to be validated before submitting the form.
- props.beforeSubmitFunc The name of the javascript function to be called before the request is submitted. The function receives ProcessForm object and the command name.
- props.validateInput Flag that denotes that Field validations should be performed or not.
- props.confirmMessage The confirmation message text to be prompted to the user.
- props.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.
- props.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 - props.callbackFunc - The Javascript function to be called after a response is received from the server. The function receives MultiPartAjaxResponse object as the parameter.
- props.userData - The user properties object to store user data.
- props.busyImage - The id or the object itself of an Image element to be displayed until a response is received from the server and processed.
- props.errorHandler - The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.
- props.waitForResponse - Flag to instruct the method to function synchronously. (Not Recommended)
Note: Parameters requiredBlocks, beforeSubmitFunc, validateInput, confirmMessageand 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 submission is canceled because of a validation error.
viewState
void viewState(props)
This method is used to store/retrieve states of browser user controls to/from MoreMotion Page Variables on the server
with XMLHttpRequest
Parameters:
props - The parameter object - props.getVars - String that contains the names of the ViewState variables (Separated with commas) to retrieve from MoreMotion.
- props.setVars - The property object that contains the names and the values of the ViewState variables to let MoreMotion to store them.
- props.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.
- props.userData - The user properties object to store user data.
- props.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.
Examples:
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 - 2010, MOR YAZILIM
Documentation generated by
JSDoc on Sun Apr 18 18:38:33 2010