Abstract Class sap.ui.core.tmpl.TemplateModule: sap/ui/core/tmpl/Template

known direct subclasses: HandlebarsTemplate

Base Class for Template.
Since: 1.15.
Constructor Summary
new sap.ui.core.tmpl.Template(sId?, mSettings?)Creates and initializes a new template with the given sId and settings.
Method Summary
sap.ui.core.tmpl.Template.byId(sId)Returns the registered template for the given ID, if any.
sap.ui.core.tmpl.Template.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.tmpl.Template with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.tmpl.Template.getMetadata()Returns a metadata object for class sap.ui.core.tmpl.Template.
sap.ui.core.tmpl.Template.parsePath(sPath)parses the given path and extracts the model and path
createControl(sId, oContext?, oView)Creates an anonymous TemplateControl for the Template.
declareControl(sControl)Declares a new control based on this template and returns the created class / constructor function.
getContent()Gets current value of property content.
placeAt(oRef, oContext?, vPosition?, bInline)Creates an anonymous TemplateControl for the Template and places the control into the specified DOM element.
setContent(sContent)Sets a new value for property content.
Constructor Detail
new sap.ui.core.tmpl.Template(sId?, mSettings?)

Creates and initializes a new template with the given sId and settings.

The set of allowed entries in the mSettings object depends on the concrete subclass and is described there.

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:

In addition, all settings applicable to the base type sap.ui.base.ManagedObject can be used as well.

Parameters:
stringsId?optional id for the new template; generated automatically if no non-empty id is given Note: this can be omitted, no matter whether mSettings will be given or not!
objectmSettings?optional map/JSON-object with initial settings for the new component instance
Method Detail
sap.ui.core.tmpl.Template.byId(sId): sap.ui.core.tmpl.Template
Returns the registered template for the given ID, if any.
Parameters:
stringsId
Returns:
sap.ui.core.tmpl.Templatethe template for the given ID
sap.ui.core.tmpl.Template.extend(sClassName, oClassInfo?, FNMetaImpl?): function

Creates a new subclass of class sap.ui.core.tmpl.Template 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.base.ManagedObject.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.Template.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.tmpl.Template.
Returns:
sap.ui.base.MetadataMetadata object describing this class
sap.ui.core.tmpl.Template.parsePath(sPath): object
parses the given path and extracts the model and path
Parameters:
stringsPaththe path
Returns:
objectthe model and the path
createControl(sId, oContext?, oView): sap.ui.core.tmpl.TemplateControl
Creates an anonymous TemplateControl for the Template.
Parameters:
stringsIdthe control ID
objectoContext?the context for the renderer/templating
sap.ui.core.mvc.ViewoView
Returns:
sap.ui.core.tmpl.TemplateControlthe created control instance
declareControl(sControl): function
Declares a new control based on this template and returns the created class / constructor function. The class is based on the information coming from the abstract functions createMetadata and createRenderer.
Parameters:
stringsControlthe fully qualified name of the control
Returns:
functionthe created class / constructor function
getContent(): string

Gets current value of property content.

The Template definition as a String.

Returns:
stringValue of property content
placeAt(oRef, oContext?, vPosition?, bInline): sap.ui.core.tmpl.TemplateControl
Creates an anonymous TemplateControl for the Template and places the control into the specified DOM element.
Parameters:
string|DomRefoRefthe id or the DOM reference where to render the template
objectoContext?The context to use to evaluate the Template. It will be applied as value for the context property of the created control.
string|intvPosition?Describes the position where the control should be put into the container
booleanbInline
Returns:
sap.ui.core.tmpl.TemplateControlthe created control instance
setContent(sContent): sap.ui.core.tmpl.Template

Sets a new value for property content.

The Template definition as a String.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
stringsContentNew value for property content
Returns:
sap.ui.core.tmpl.TemplateReference to this in order to allow method chaining