This is the base class for all template controls. Template controls are declared based on templates.
Experimental API:Since version 1.15. The templating might be changed in future versions.
Event Summary
afterRendering(oControlEvent)Fired when the Template Control has been (re-)rendered and its HTML is present in the DOM. beforeRendering(oControlEvent)Fired before this Template Control is re-rendered. Method Summary
sap.ui.core.tmpl.TemplateControl.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.tmpl.TemplateControl with name sClassName
and enriches it with the information contained in oClassInfo
. attachAfterRendering(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the afterRendering
event of this sap.ui.core.tmpl.TemplateControl
. attachBeforeRendering(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the beforeRendering
event of this sap.ui.core.tmpl.TemplateControl
. bindList(sPath)Creates a pseudo binding for a aggregation to get notified once the property changes to invalidate the control and trigger a re-rendering. bindProp(sPath)Creates a pseudo binding for a property to get notified once the property changes to invalidate the control and trigger a re-rendering. createControl(mSettings, sParentPath?, bDoNotAdd?, oView)compiles (creates and registers) a new control createDOMElement(mSettings, sParentPath?, bDoNotAdd?)compiles (creates and registers) a new DOM element detachAfterRendering(fnFunction, oListener)Detaches event handler fnFunction
from the afterRendering
event of this sap.ui.core.tmpl.TemplateControl
. detachBeforeRendering(fnFunction, oListener)Detaches event handler fnFunction
from the beforeRendering
event of this sap.ui.core.tmpl.TemplateControl
. getContext()Gets current value of property context
. getTemplate()ID of the element which is the current target of the association template
, or null
. isInline()checks whether the control is inline or not setContext(oContext)Sets a new value for property context
. setTemplateRenderer(fnRenderer)Sets the instance specific renderer for an anonymous template control. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getAccessibilityInfo,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
invalidate,
isBusy,
onAfterRendering,
onBeforeRendering,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
exit,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
init,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.ui.core.tmpl.TemplateControl(sId?, mSettings?)
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 for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- Aggregations
- Events
- afterRendering : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- beforeRendering : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
Parameters:
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
Event Detail
afterRendering(oControlEvent)
Fired when the Template Control has been (re-)rendered and its HTML is present in the DOM.
Parameters:
beforeRendering(oControlEvent)
Fired before this Template Control is re-rendered. Use to unbind event handlers from HTML elements etc.
Parameters:
Method Detail
sap.ui.core.tmpl.TemplateControl.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.ui.core.tmpl.TemplateControl.
Returns:
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.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.tmpl.TemplateControl itself |
Returns:
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.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.tmpl.TemplateControl itself |
Returns:
bindList(sPath): any
Creates a pseudo binding for a aggregation to get notified once the property changes to invalidate the control and trigger a re-rendering.
Parameters:
{string} | sPath | the binding path |
Returns:
{any} | the value of the path |
bindProp(sPath): any
Creates a pseudo binding for a property to get notified once the property changes to invalidate the control and trigger a re-rendering.
Parameters:
{string} | sPath | the binding path |
Returns:
{any} | the value of the path |
compiles (creates and registers) a new control
Parameters:
{object} | mSettings | the settings for the new control |
{string} | sParentPath? | the parent path for the control |
{boolean} | bDoNotAdd? | if true, then the control will not be added to the _controls aggregation |
{sap.ui.core.mvc.View} | oView | |
Returns:
compiles (creates and registers) a new DOM element
Parameters:
{object} | mSettings | the settings for the new DOM element |
{string} | sParentPath? | the parent path for the DOM element |
{boolean} | bDoNotAdd? | if true, then the control will not be added to the _controls aggregation |
Returns:
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.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
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.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Fires event afterRendering
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event beforeRendering
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getContext(): object
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:
{object} | Value of property context |
ID of the element which is the current target of the association template
, or null
.
Returns:
getTemplateRenderer(): function
Returns the instance specific renderer for an anonymous template control.
Returns:
{function} | the instance specific renderer function |
isInline(): boolean
checks whether the control is inline or not
Returns:
{boolean} | flag, whether to control is inline or not |
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.
Parameters:
{object} | oContext | New value for property context |
Returns:
Sets the associated template
.
Parameters:
{sap.ui.core.tmpl.Template} | oTemplate | Id of an element which becomes the new target of this template association; alternatively, an element instance may be given |
Returns:
Sets the instance specific renderer for an anonymous template control.
Parameters:
{function} | fnRenderer | the instance specific renderer function |
Returns: