Class sap.ui.core.tmpl.TemplateControlModule: sap/ui/core/tmpl/TemplateControl

extends Control

This is the base class for all template controls. Template controls are declared based on templates.
Since: 1.15.
Constructor Summary
new sap.ui.core.tmpl.TemplateControl(sId?, mSettings?)Constructor for a new tmpl/TemplateControl.
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.
Events borrowed from class sap.ui.core.Control
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.
sap.ui.core.tmpl.TemplateControl.getMetadata()Returns a metadata object for class sap.ui.core.tmpl.TemplateControl.
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 an 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.
fireAfterRendering(mParameters?)Fires event afterRendering to attached listeners.
fireBeforeRendering(mParameters?)Fires event beforeRendering to attached listeners.
getContext()Gets current value of property context.
getTemplate()ID of the element which is the current target of the association template, or null.
getTemplateRenderer()Returns the instance specific renderer for an anonymous template control.
isInline()checks whether the control is inline or not
setContext(oContext)Sets a new value for property context.
setTemplate(oTemplate)Sets the associated template.
setTemplateRenderer(fnRenderer)Sets the instance specific renderer for an anonymous template control.
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

    • Associations

      • template : (sap.ui.core.ID | sap.ui.core.tmpl.Template)

    • 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:
    stringsId?id for the new control, generated automatically if no id is given
    objectmSettings?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:
    sap.ui.base.EventoControlEvent
    sap.ui.base.EventProvideroControlEvent.getSource
    objectoControlEvent.getParameters
    beforeRendering(oControlEvent)
    Fired before this Template Control is re-rendered. Use to unbind event handlers from HTML elements etc.
    Parameters:
    sap.ui.base.EventoControlEvent
    sap.ui.base.EventProvideroControlEvent.getSource
    objectoControlEvent.getParameters
    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:
    stringsClassNameName of the class being created
    objectoClassInfo?Object literal with information about the class
    functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
    Returns:
    functionCreated class / constructor function
    sap.ui.core.tmpl.TemplateControl.getMetadata(): sap.ui.base.Metadata
    Returns a metadata object for class sap.ui.core.tmpl.TemplateControl.
    Returns:
    sap.ui.base.MetadataMetadata object describing this class
    attachAfterRendering(oData?, fnFunction, oListener?): sap.ui.core.tmpl.TemplateControl

    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:
    objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
    functionfnFunctionThe function to be called when the event occurs
    objectoListener?Context object to call the event handler with. Defaults to this sap.ui.core.tmpl.TemplateControl itself
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    attachBeforeRendering(oData?, fnFunction, oListener?): sap.ui.core.tmpl.TemplateControl

    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:
    objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
    functionfnFunctionThe function to be called when the event occurs
    objectoListener?Context object to call the event handler with. Defaults to this sap.ui.core.tmpl.TemplateControl itself
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    bindList(sPath): any
    Creates a pseudo binding for an aggregation to get notified once the property changes to invalidate the control and trigger a re-rendering.
    Parameters:
    stringsPaththe binding path
    Returns:
    anythe 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:
    stringsPaththe binding path
    Returns:
    anythe value of the path
    createControl(mSettings, sParentPath?, bDoNotAdd?, oView): sap.ui.core.Control
    compiles (creates and registers) a new control
    Parameters:
    objectmSettingsthe settings for the new control
    stringsParentPath?the parent path for the control
    booleanbDoNotAdd?if true, then the control will not be added to the _controls aggregation
    sap.ui.core.mvc.ViewoView
    Returns:
    sap.ui.core.Controlnew control instance
    createDOMElement(mSettings, sParentPath?, bDoNotAdd?): sap.ui.core.Control
    compiles (creates and registers) a new DOM element
    Parameters:
    objectmSettingsthe settings for the new DOM element
    stringsParentPath?the parent path for the DOM element
    booleanbDoNotAdd?if true, then the control will not be added to the _controls aggregation
    Returns:
    sap.ui.core.Controlnew DOM element instance
    detachAfterRendering(fnFunction, oListener): sap.ui.core.tmpl.TemplateControl

    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:
    functionfnFunctionThe function to be called, when the event occurs
    objectoListenerContext object on which the given function had to be called
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    detachBeforeRendering(fnFunction, oListener): sap.ui.core.tmpl.TemplateControl

    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:
    functionfnFunctionThe function to be called, when the event occurs
    objectoListenerContext object on which the given function had to be called
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    fireAfterRendering(mParameters?): sap.ui.core.tmpl.TemplateControl
    Fires event afterRendering to attached listeners.
    Parameters:
    objectmParameters?Parameters to pass along with the event
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    fireBeforeRendering(mParameters?): sap.ui.core.tmpl.TemplateControl
    Fires event beforeRendering to attached listeners.
    Parameters:
    objectmParameters?Parameters to pass along with the event
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    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:
    objectValue of property context
    getTemplate(): sap.ui.core.ID
    ID of the element which is the current target of the association template, or null.
    Returns:
    sap.ui.core.ID
    getTemplateRenderer(): function
    Returns the instance specific renderer for an anonymous template control.
    Returns:
    functionthe instance specific renderer function
    isInline(): boolean
    checks whether the control is inline or not
    Returns:
    booleanflag, whether to control is inline or not
    setContext(oContext): 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.

    Parameters:
    objectoContextNew value for property context
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    setTemplate(oTemplate): sap.ui.core.tmpl.TemplateControl
    Sets the associated template.
    Parameters:
    sap.ui.core.ID|sap.ui.core.tmpl.TemplateoTemplateID of an element which becomes the new target of this template association; alternatively, an element instance may be given
    Returns:
    sap.ui.core.tmpl.TemplateControlReference to this in order to allow method chaining
    setTemplateRenderer(fnRenderer): sap.ui.core.tmpl.Template
    Sets the instance specific renderer for an anonymous template control.
    Parameters:
    functionfnRendererthe instance specific renderer function
    Returns:
    sap.ui.core.tmpl.Templatethis to allow method chaining