Constructor
new Component(_idopt, _parentViewIdopt, _parentContainerIdopt, _createDOMElementopt)
- Source:
Creates an instance of Component.
Example
Create an instance of Component in View Class in "createViewContent" method
createViewContent() {
let tmpViewContentEl = this.createViewHTML();
this.addToViewElement(tmpViewContentEl);
this.cmpButton1 = new MyButton("cmpBtn",this.id,"helloContainer",true);
this.cmpButton1.init("My Component");
this.cmpButton1.attach();
this.cmpButton1.enabled = true;
}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
_id |
string |
<optional> |
null
|
ComponentID |
_parentViewId |
string |
<optional> |
null
|
Component Parent View ID |
_parentContainerId |
string |
<optional> |
null
|
Component Parent Container ID |
_createDOMElement |
boolean |
<optional> |
true
|
True if Component DOM element create from Template , False if taken from DOM. |
Classes
Members
componentElement
- Source:
returns Component DOM Element
currentState
- Source:
returns Component current state
enabled
- Source:
Boolean Property , returns True if Component is Enabled
parentContainer
- Source:
returns Parent Container ID
parentView
- Source:
returns ParentViewID
readOnly
- Source:
returns True if Component is ResdyOnly
required
- Source:
returns True if Component is Required
visible
- Source:
Boolean Property , returns True if Component is Visible
Methods
addEventHandler()
- Source:
Add Event Handlers for Component DOM Elements and Model Call by attach & set domElement Method
addToComponentElement(_tmpCompContentEl)
- Source:
Add Component Content DOM Element to Component
Parameters:
Name | Type | Description |
---|---|---|
_tmpCompContentEl |
string | DOMElement |
attach()
- Source:
Component Lifecycle Method Call by View or call manually attach Responsible to render component content, listners etc Dispatch "ATTACHED_EVENT" when view got attached / rendered Following methods call by attach method createDOMContent addViewHandler bind
bind()
- Source:
Overrides by SubClass Bind Component Properties with Model or other Components call by attach & view
changeComponentState()
- Source:
change Component State Overrides by Subclass
changeState()
- Source:
change Component State
createDOMContent()
- Source:
creates DOM Contents of Component Overrides by SubClass Call by attach Method
destroy()
- Source:
Overrides by SubClass Destroy Method used to cleanup component resources Call by View or call manually to destroy view Remove Event Handlers, Make Properties null, Remove DOM Element contents and its reference.
detach()
- Source:
Component Lifecycle Method Call by View or call manually Component will be remove if Component is attached
init()
- Source:
Initialise Component properties and model Call by View or Parent
initComponent()
- Source:
call by init method
refresh()
- Source:
Refresh Component data and model and event listners Overrides by SubClass
removeEventHandler()
- Source:
Remove Event Handlers for Component DOM Elements and Model call by destroy method
setComponentEnabled()
- Source:
Overrides by Subclass
setComponentReadOnly()
- Source:
Overrides by Subclass
setComponentRequired()
- Source:
Overrides by Subclass
unBind()
- Source:
Overrides by SubClass Remove Bind on Component Properties with Model or other Components