Class AMI.Module
Create components, process actions, handle components events.
Defined in: AMI.Module.js.
Constructor Attributes | Constructor Name and Description |
---|---|
AMI.Module(moduleId, oModuleComponents)
Class required for creating module on page with asyncronous components work.
|
Method Attributes | Method Name and Description |
---|---|
addComponent(componentId, componentType)
Add and place component to module.
|
|
addHashDataAndReloadList(oComponent, oParameters)
Add data to hash and reload list after that.
|
|
getActionComponent(mComponent)
Get component object by component id.
|
|
getActionParameters(parameters)
Get action parameters from the GET string or associative array.
|
|
getComponentsByType(type)
Found and return components by type as array.
|
|
Get module container (DOM element that contains module content).
|
|
init(oComponents)
Set module container, add message handlers and add components of module
|
|
onComponentClick(oEvent, oComponent)
Find clicked component and check if this should create action.
|
|
onComponentContentPlaced(oComponent, oData)
Callback method that listens ON_COMPONENT_CONTENT_PLACED message and makes required actions (like other components reload, rows higlighting, etc) when component content places.
|
|
onComponentGetRequestData(oComponent, oParameters)
Add custom data when component requested before loading its content.
|
|
openEditForm(oParameters, skipScrollToForm)
Open edit form by id in oParameters and scroll to.
|
|
processModuleAction(mComponent, action, parameters)
Do module action.
|
|
reloadList(oComponent)
Reload default or exact module list component.
|
Class Detail
AMI.Module(moduleId, oModuleComponents)
Class required for creating module on page with asyncronous components work.
- Parameters:
- {string} moduleId
- Id of current module.
- {object} oModuleComponents
- Associative array of components that should be added in module.
Method Detail
{void}
addComponent(componentId, componentType)
Add and place component to module.
- Parameters:
- {string} componentId
- Id of the components.
- {string} componentType
- One of filter_form, list, form.
- Returns:
- {void}
{void}
addHashDataAndReloadList(oComponent, oParameters)
Add data to hash and reload list after that.
- Parameters:
- {AMI.ModuleComponent} oComponent
- List component object.
- {object} oParameters
- Associative array of parameters that will be set to hash.
- Returns:
- {void}
{AMI.ModuleComponent}
getActionComponent(mComponent)
Get component object by component id.
- Parameters:
- {mixed} mComponent
- Component id. This parameter could also be the component object.
- Returns:
- {AMI.ModuleComponent} Component object.
{object}
getActionParameters(parameters)
Get action parameters from the GET string or associative array.
- Parameters:
- {mixed} parameters
- Search part of get string (a=b&c=d etc) or associative array.
- Returns:
- {object} Associative array of parameters.
{array}
getComponentsByType(type)
Found and return components by type as array.
- Parameters:
- {string} type
- Type of component (filter_form, list, form or other).
- Returns:
- {array} Found components array.
{DOM object}
getContainer()
Get module container (DOM element that contains module content).
- Returns:
- {DOM object} DOM element that contains module content.
{void}
init(oComponents)
Set module container, add message handlers and add components of module
- Parameters:
- {object} oComponents
- Associative array that describes components placed in module. Format is {componentId1:componentType1, componentId2:componentType2, etc..} where componentType one of "filter_form", "list", "form".
- Returns:
- {void}
{bool}
onComponentClick(oEvent, oComponent)
Find clicked component and check if this should create action. Calling AMI.Module.processModuleAction if required.
- Parameters:
- {object} oEvent
- Event object.
- {AMI.ModuleComponent} oComponent
- Component that owns clicked DOM object.
- Returns:
- {bool} true if no actions should be done and false otherwise. Return is required for event processing.
{void}
onComponentContentPlaced(oComponent, oData)
Callback method that listens ON_COMPONENT_CONTENT_PLACED message and makes required actions (like other components reload, rows higlighting, etc) when component content places.
To create your own callback create ON_COMPONENT_CONTENT_PLACED handler in your code.
- Parameters:
- {AMI.ModuleComponent} oComponent
- Component object that sended request to data.
- {object} oData
- Reserved, always null.
- Returns:
- {void}
{void}
onComponentGetRequestData(oComponent, oParameters)
Add custom data when component requested before loading its content. Method called when ON_COMPONENT_GET_REQUEST_DATA message received.
To create your own callback create ON_COMPONENT_GET_REQUEST_DATA handler in your code.
- Parameters:
- {AMI.ModuleComponent} oComponent
- Component object that sended request to data.
- {object} oParameters
- Associative array of data that will be submitted on component content request. Add data to this object if required.
- Returns:
- {void}
{void}
openEditForm(oParameters, skipScrollToForm)
Open edit form by id in oParameters and scroll to.
- Parameters:
- {object} oParameters
- Associative array where id key should esists.
- {bool} skipScrollToForm
- If true page will not be scrolled to form. false is default.
- Returns:
- {void}
{void}
processModuleAction(mComponent, action, parameters)
Do module action. There are several cases in the method. Almost all methods uses AMI.Module.addHashDataAndReloadList.
- Parameters:
- {mixed} mComponent
- Component id. This parameter could also be the component object.
- {string} action
- Module action.
- {mixed} parameters
- Search part of get string (a=b&c=d etc) or associative array.
- Returns:
- {void}
{void}
reloadList(oComponent)
Reload default or exact module list component.
- Parameters:
- {AMI.ModuleComponent} oComponent
- Module component object. Can be null - in this case method will get the default list component.
- Returns:
- {void}