AMI Web Framework API > Class > Control
ami.Control
The basic AMI control
Implements: ami.IControl
Constructor
Control(parentnull, ownernull)
Parameters:
| Name | Type | Description | Optional | Nullable |
|---|---|---|---|---|
| parent | * | the parent entity | ✓ | |
| owner | * | the owner entity | ✓ |
Methods
onReady() ->{$.Promise or $.Deferred or undefined}
Called when the control is ready to run
Returns:
A JQuery promise object, deferred object or nothing
Type: $.Promise or $.Deferred or undefined
onRemove() ->{$.Promise or $.Deferred or undefined}
Called when the control is removed
Returns:
A JQuery promise object, deferred object or nothing
Type: $.Promise or $.Deferred or undefined
patchId(id) ->{string}
Patches an HTML identifier
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| id | string | the not patched HTML identifier |
Returns:
The patched HTML identifier
Type: string
replaceHTML(selector, twig, options) ->{$.Promise}
Puts a HTML or TWIG fragment to the given target, see method [formatTWIG]{@link #jsdoc_method_formatTWIG}
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| selector | string | the target selector | |||
| twig | string | the TWIG fragment | {} | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, dict, twigs) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
prependHTML(selector, twig, options) ->{$.Promise}
Prepends a HTML or TWIG fragment to the given target, see method [formatTWIG]{@link #jsdoc_method_formatTWIG}
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| selector | string | the target selector | |||
| twig | string | the TWIG fragment | {} | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, dict, twigs) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
appendHTML(selector, twig, options) ->{$.Promise}
Appends a HTML or TWIG fragment to the given target, see method [formatTWIG]{@link #jsdoc_method_formatTWIG}
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| selector | string | the target selector | |||
| twig | string | the TWIG fragment | {} | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, dict, twigs) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
setupCtx(immutables, defaults, options) ->{Object.<string, *>}
Sets up the control's context
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| immutables | Object.<string, *> | dictionary of immutable parameters in the control's context | |||
| defaults | Object.<string, *> | dictionary of default values for optional parameters | |||
| options | Object.<string, *> | dictionary of values for optional parameters |
Returns:
The resulting control's context
Type: Object.<string, *>
createControl(parentnull, control, params, options) ->{$.Promise}
Asynchronously creates a control
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| control | string | the control name | |||
| params | Array.<*> | the control's parameters | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
createControlInBody(parentnull, control, controlParams, controlOptions, options) ->{$.Promise}
Asynchronously creates a control in the body
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| control | string | the control name | |||
| controlParams | Array.<*> | the control's render method mandatory parameters | |||
| controlOptions | Object.<string, *> | the control's render method optional parameters | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
createControlInContainer(parentnull, control, controlParams, controlOptions, icon, title, options) ->{$.Promise}
Asynchronously creates a control in a container
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| control | string | the control name | |||
| controlParams | Array.<*> | the control's render method mandatory parameters | |||
| controlOptions | Object.<string, *> | the control's render method optional parameters | |||
| icon | string | the icon | |||
| title | string | the title | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
createControlFromWebLink(parentnull, el, options) ->{$.Promise}
Asynchronously creates a control in a container from a WEB link
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| el | Element | the HTML element | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise