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.

Experimental API:Since version 1.15. The templating might be changed in future versions.

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 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.
fireAfterRendering(mArguments?)Fires event afterRendering to attached listeners.
fireBeforeRendering(mArguments?)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
    • 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:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    beforeRendering(oControlEvent)
    Fired before this Template Control is re-rendered. Use to unbind event handlers from HTML elements etc.
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.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:
    {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
    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.Metadata} Metadata 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:
    {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:
    {sap.ui.core.tmpl.TemplateControl} Reference 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:
    {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:
    {sap.ui.core.tmpl.TemplateControl} Reference to this in order to allow method chaining
    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
    createControl(mSettings, sParentPath?, bDoNotAdd?, oView): sap.ui.core.Control
    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:
    {sap.ui.core.Control} new control instance
    createDOMElement(mSettings, sParentPath?, bDoNotAdd?): sap.ui.core.Control
    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:
    {sap.ui.core.Control} new 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:
    {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:
    {sap.ui.core.tmpl.TemplateControl} Reference 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:
    {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:
    {sap.ui.core.tmpl.TemplateControl} Reference to this in order to allow method chaining
    fireAfterRendering(mArguments?): sap.ui.core.tmpl.TemplateControl
    Fires event afterRendering to attached listeners.
    Parameters:
    {Map}mArguments? The arguments to pass along with the event
    Returns:
    {sap.ui.core.tmpl.TemplateControl} Reference to this in order to allow method chaining
    fireBeforeRendering(mArguments?): sap.ui.core.tmpl.TemplateControl
    Fires event beforeRendering to attached listeners.
    Parameters:
    {Map}mArguments? The arguments to pass along with the event
    Returns:
    {sap.ui.core.tmpl.TemplateControl} Reference 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:
    {object} Value of property context
    ID of the element which is the current target of the association template, or null.
    Returns:
    {sap.ui.core.tmpl.Template}
    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
    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:
    {object}oContext New value for property context
    Returns:
    {sap.ui.core.tmpl.TemplateControl} Reference to this in order to allow method chaining
    setTemplate(oTemplate): sap.ui.core.tmpl.TemplateControl
    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:
    {sap.ui.core.tmpl.TemplateControl} Reference 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:
    {function}fnRenderer the instance specific renderer function
    Returns:
    {sap.ui.core.tmpl.Template}this to allow method chaining