Class AMI.ModuleComponent
Base module component class that releases default functionality.
Defined in: AMI.ModuleComponent.js.
Constructor Attributes | Constructor Name and Description |
---|---|
AMI.ModuleComponent(oModule, componentType, componentId)
Base component class contains all required functionality for component work.
|
Method Attributes | Method Name and Description |
---|---|
Get component container that contents component data.
|
|
Request component content from server.
|
|
Get the filter for hash data.
|
|
Get module id of current component.
|
|
Hide loader with background overlay.
|
|
init()
Create component place and request its content
|
|
Method that could be overriden.
|
|
onContentReceived(state, content)
Callback for this.getContent.
|
|
setBlockDataFromObject(oData)
Method that should be overriden.
|
|
setDebug(debugData)
Set debug container if absent for component area and print debug content.
|
|
Create component place and loader on the page with id component_{module id}_{component type}_{component id}.
|
|
Show component loader with background overlay.
|
Class Detail
AMI.ModuleComponent(oModule, componentType, componentId)
Base component class contains all required functionality for component work. This couldn't be used directly and should be inherited in custom component class.
Example of inheriting this class: AMI.ModuleComponentCustom = function(oModule, componentType, componentId){ AMI.ModuleComponentCustom.superclass.constructor.call(this, oModule, componentType, componentId); // Custom objects definitioun here this.init(); } AMI.inherit(AMI.ModuleComponentCustom, AMI.ModuleComponent);
- Parameters:
- {AMI.Module} oModule
- Module object.
- {string} componentType
- Type of component (filter_form, form, list).
- {string} componentId
- Id of current component.
Method Detail
{DOM object}
getContainer()
Get component container that contents component data.
- Returns:
- {DOM object} Object that contains component data.
{void}
getContent()
Request component content from server. When responce is received this.onContentReceived is called.
- Returns:
- {void}
{string}
getHashDataFilter()
Get the filter for hash data. Filter required to select parameters for current component only. For example, flt_ for filter etc. By default it is ".*".
- Returns:
- {string} Hash filter string.
{string}
getModuleId()
Get module id of current component.
- Returns:
- {string} Module id.
{void}
hideLoader()
Hide loader with background overlay.
- Returns:
- {void}
{void}
init()
Create component place and request its content
- Returns:
- {void}
{void}
onComponentContentPlaced()
Method that could be overriden. Called after the component placed its content.
- Returns:
- {void}
{void}
onContentReceived(state, content)
Callback for this.getContent. AMI.HTTPRequest calls this method when content is received.
Before placing content to component area method sends ON_COMPONENT_CONTENT_RECEIVED message.
After the content is placed ON_COMPONENT_CONTENT_PLACED will be sent.
- Parameters:
- {number} state
- XHR responce state. 1 = success.
- {string} content
- Response from server.
- Returns:
- {void}
{void}
setBlockDataFromObject(oData)
Method that should be overriden. Called when content for component received and the content is object.
- Parameters:
- {object} oData
- Evalled content that was received from server.
- Returns:
- {void}
{void}
setDebug(debugData)
Set debug container if absent for component area and print debug content.
- Parameters:
- {string} debugData
- Debug string that will be printed separatelly in debug block.
- Returns:
- {void}
{void}
setObject()
Create component place and loader on the page with id component_{module id}_{component type}_{component id}. Also request content of component.
- Returns:
- {void}
{void}
showLoader()
Show component loader with background overlay.
- Returns:
- {void}