This is the base class for all template controls. Template controls are declared based on templates.
Constructor for a new tmpl/TemplateControl.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.ui.core.tmpl.TemplateControl(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | id for the new control, generated automatically if no id is given |
|
mSettings? | object | initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
context | object | The context is a data object. It can be used for default template expressions. A change of the context object leads to a re-rendering whereas a change of a nested property of the context object doesn't. By default the context is an empty object. Visibility: public |
Name | Type | Default Value | Description |
---|---|---|---|
blocked | boolean | false | Whether the control is currently in blocked state. Visibility: public |
busy | boolean | false | Whether the control is currently in busy state. Visibility: public |
busyIndicatorDelay | int | 1000 | The delay in milliseconds, after which the busy indicator will show up for this control. Visibility: public |
busyIndicatorSize | sap.ui.core.BusyIndicatorSize | Medium | The size of the BusyIndicator. For controls with a width smaller 3rem a |
fieldGroupIds | string[] | The IDs of a logical field group that this control belongs to. All fields in a logical field group should share the same For backward compatibility with older releases, field group IDs are syntactically not limited, but it is suggested to use only valid sap.ui.core.IDs. See #attachValidateFieldGroup or consult the Field Group documentation. |
|
visible | boolean | true | Whether the control should be visible on the screen. If set to false, a placeholder will be rendered to mark the location of the invisible control in the DOM of the current page. The placeholder will be hidden and have zero dimensions ( Also see InvisibleRenderer. Visibility: public |
Default Aggregation:
Name | Cardinality | Type | Description |
---|---|---|---|
controls | 0..n | sap.ui.core.Control |
The nested controls of the template control |
Name | Cardinality | Type | Description |
---|---|---|---|
customData | 0..n | sap.ui.core.CustomData |
Custom Data, a data structure like a map containing arbitrary key value pairs. |
dependents | 0..n | sap.ui.core.Element |
Dependents are not rendered, but their databinding context and lifecycle are bound to the aggregating Element. |
dragDropConfig | 0..n | sap.ui.core.dnd.DragDropBase |
Defines the drag-and-drop configuration. Note: This configuration might be ignored due to control metadata restrictions. |
layoutData | 0..1 | sap.ui.core.LayoutData |
Defines the layout constraints for this control when it is used inside a Layout. LayoutData classes are typed classes and must match the embedding Layout. See VariantLayoutData for aggregating multiple alternative LayoutData instances to a single Element. |
tooltip | 0..1 | sap.ui.core.TooltipBase |
The tooltip that should be shown for this Element. In the most simple case, a tooltip is a string that will be rendered by the control and displayed by the browser when the mouse pointer hovers over the control's DOM. In this variant, Controls need to explicitly support this kind of tooltip as they have to render it, but most controls do. Exceptions will be documented for the corresponding controls (e.g. Alternatively, UI5 currently does not provide a recommended implementation of See the section Using Tooltips
|
Name | Cardinality | Type | Description |
---|---|---|---|
template | 0..1 | sap.ui.core.tmpl.Template |
The template on which the template control is based on. |
Event | Description |
---|---|
afterRendering |
Fired when the Template Control has been (re-)rendered and its HTML is present in the DOM. |
beforeRendering |
Fired before this Template Control is re-rendered. Use to unbind event handlers from HTML elements etc. |
Method | Description |
---|---|
attachAfterRendering |
Attaches event handler When called, the context of the event handler (its Fired when the Template Control has been (re-)rendered and its HTML is present in the DOM. |
attachBeforeRendering |
Attaches event handler When called, the context of the event handler (its Fired before this Template Control is re-rendered. Use to unbind event handlers from HTML elements etc. |
bindList |
Creates a pseudo binding for an aggregation to get notified once the property changes to invalidate the control and trigger a re-rendering. |
bindProp |
Creates a pseudo binding for a property to get notified once the property changes to invalidate the control and trigger a re-rendering. |
createControl |
compiles (creates and registers) a new control |
createDOMElement |
compiles (creates and registers) a new DOM element |
detachAfterRendering |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachBeforeRendering |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.core.tmpl.TemplateControl.extend |
Creates a new subclass of class sap.ui.core.tmpl.TemplateControl with name
|
fireAfterRendering |
Fires event afterRendering to attached listeners. |
fireBeforeRendering |
Fires event beforeRendering to attached listeners. |
getContext |
Gets current value of property context. The context is a data object. It can be used for default template expressions. A change of the context object leads to a re-rendering whereas a change of a nested property of the context object doesn't. By default the context is an empty object. |
sap.ui.core.tmpl.TemplateControl.getMetadata |
Returns a metadata object for class sap.ui.core.tmpl.TemplateControl. |
getTemplate |
ID of the element which is the current target of the association template, or |
getTemplateRenderer |
Returns the instance specific renderer for an anonymous template control. |
isInline |
checks whether the control is inline or not |
setContext |
Sets a new value for property context. The context is a data object. It can be used for default template expressions. A change of the context object leads to a re-rendering whereas a change of a nested property of the context object doesn't. By default the context is an empty object. When called with a value of |
setTemplate |
Sets the associated template. |
setTemplateRenderer |
Sets the instance specific renderer for an anonymous template control. |
Attaches event handler fnFunction
to the afterRendering event of this sap.ui.core.tmpl.TemplateControl
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.tmpl.TemplateControl
itself.
Fired when the Template Control has been (re-)rendered and its HTML is present in the DOM.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Attaches event handler fnFunction
to the beforeRendering event of this sap.ui.core.tmpl.TemplateControl
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.tmpl.TemplateControl
itself.
Fired before this Template Control is re-rendered. Use to unbind event handlers from HTML elements etc.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Creates a pseudo binding for an aggregation to get notified once the property changes to invalidate the control and trigger a re-rendering.
Param | Type | DefaultValue | Description |
---|---|---|---|
sPath | string |
the binding path |
Creates a pseudo binding for a property to get notified once the property changes to invalidate the control and trigger a re-rendering.
Param | Type | DefaultValue | Description |
---|---|---|---|
sPath | string |
the binding path |
compiles (creates and registers) a new control
Param | Type | DefaultValue | Description |
---|---|---|---|
mSettings | object |
the settings for the new control |
|
sParentPath | string |
the parent path for the control |
|
bDoNotAdd | boolean |
if true, then the control will not be added to the _controls aggregation |
|
oView | sap.ui.core.mvc.View |
compiles (creates and registers) a new DOM element
Param | Type | DefaultValue | Description |
---|---|---|---|
mSettings | object |
the settings for the new DOM element |
|
sParentPath | string |
the parent path for the DOM element |
|
bDoNotAdd | boolean |
if true, then the control will not be added to the _controls aggregation |
Detaches event handler fnFunction
from the afterRendering event of this sap.ui.core.tmpl.TemplateControl
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches event handler fnFunction
from the beforeRendering event of this sap.ui.core.tmpl.TemplateControl
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Creates a new subclass of class sap.ui.core.tmpl.TemplateControl with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event afterRendering to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Fires event beforeRendering to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Gets current value of property context.
The context is a data object. It can be used for default template expressions. A change of the context object leads to a re-rendering whereas a change of a nested property of the context object doesn't. By default the context is an empty object.
Returns a metadata object for class sap.ui.core.tmpl.TemplateControl.
Sets a new value for property context.
The context is a data object. It can be used for default template expressions. A change of the context object leads to a re-rendering whereas a change of a nested property of the context object doesn't. By default the context is an empty object.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
oContext | object |
New value for property |
Sets the associated template.
Param | Type | DefaultValue | Description |
---|---|---|---|
oTemplate | sap.ui.core.ID sap.ui.core.tmpl.Template |
ID of an element which becomes the new target of this template association; alternatively, an element instance may be given |