Class sap.ui.core.tmpl.DOMElementModule: sap/ui/core/tmpl/DOMElement

extends Control

Represents a DOM element. It allows to use databinding for the properties and nested DOM attributes.

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

Constructor Summary
new sap.ui.core.tmpl.DOMElement(sId?, mSettings?)Constructor for a new tmpl/DOMElement.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.core.tmpl.DOMElement.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.tmpl.DOMElement with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.tmpl.DOMElement.getMetadata()Returns a metadata object for class sap.ui.core.tmpl.DOMElement.
addAttribute(oAttribute)Adds some attribute to the aggregation attributes.
addElement(oElement)Adds some element to the aggregation elements.
attr(sName, sValue)Returns the value of a DOM attribute if available or undefined if the DOM attribute is not available when using this method with the parameter name only.
destroyAttributes()Destroys all the attributes in the aggregation attributes.
destroyElements()Destroys all the elements in the aggregation elements.
getAttributes()Gets content of aggregation attributes.
getElements()Gets content of aggregation elements.
getTag()Gets current value of property tag.
getText()Gets current value of property text.
indexOfAttribute(oAttribute)Checks for the provided sap.ui.core.tmpl.DOMAttribute in the aggregation attributes.
indexOfElement(oElement)Checks for the provided sap.ui.core.tmpl.DOMElement in the aggregation elements.
insertAttribute(oAttribute, iIndex)Inserts a attribute into the aggregation attributes.
insertElement(oElement, iIndex)Inserts a element into the aggregation elements.
removeAllAttributes()Removes all the controls from the aggregation attributes.
removeAllElements()Removes all the controls from the aggregation elements.
removeAttr(sName)Removes the DOM attribute for the given name and returns the reference to this DOM element to support method chaining.
removeAttribute(vAttribute)Removes a attribute from the aggregation attributes.
removeElement(vElement)Removes a element from the aggregation elements.
setTag(sTag)Sets a new value for property tag.
setText(sText)Sets a new value for property text.
Constructor Detail
new sap.ui.core.tmpl.DOMElement(sId?, mSettings?)
Constructor for a new tmpl/DOMElement.

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
    • text : string
    • tag : string (default: span)
  • Aggregations
    • attributes : sap.ui.core.tmpl.DOMAttribute[] (default)
    • elements : sap.ui.core.tmpl.DOMElement[]

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
Method Detail
sap.ui.core.tmpl.DOMElement.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.tmpl.DOMElement 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.DOMElement.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.tmpl.DOMElement.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addAttribute(oAttribute): sap.ui.core.tmpl.DOMElement
Adds some attribute to the aggregation attributes.
Parameters:
{sap.ui.core.tmpl.DOMAttribute}oAttribute the attribute to add; if empty, nothing is inserted
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining
addElement(oElement): sap.ui.core.tmpl.DOMElement
Adds some element to the aggregation elements.
Parameters:
{sap.ui.core.tmpl.DOMElement}oElement the element to add; if empty, nothing is inserted
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining
attr(sName, sValue): any
Returns the value of a DOM attribute if available or undefined if the DOM attribute is not available when using this method with the parameter name only. When using the method with the parameter name and value the method acts as a setter and sets the value of a DOM attribute. In this case the return value is the reference to this DOM element to support method chaining. If you pass null as value of the attribute the attribute will be removed.
Parameters:
{string}sName The name of the DOM attribute.
{string}sValue The value of the DOM attribute. If the value is undefined the DOM attribute will be removed.
Returns:
{any} value of attribute or this when called as a setter
destroyAttributes(): sap.ui.core.tmpl.DOMElement
Destroys all the attributes in the aggregation attributes.
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining
destroyElements(): sap.ui.core.tmpl.DOMElement
Destroys all the elements in the aggregation elements.
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining
getAttributes(): sap.ui.core.tmpl.DOMAttribute[]
Gets content of aggregation attributes.

DOM attributes which are rendered as part of the DOM element and bindable

Returns:
{sap.ui.core.tmpl.DOMAttribute[]}
getElements(): sap.ui.core.tmpl.DOMElement[]
Gets content of aggregation elements.

Nested DOM elements to support nested bindable structures

Returns:
{sap.ui.core.tmpl.DOMElement[]}
getTag(): string
Gets current value of property tag.

The HTML-tag of the DOM element which contains the text

Default value is span.

Returns:
{string} Value of property tag
getText(): string
Gets current value of property text.

The text content of the DOM element

Returns:
{string} Value of property text
indexOfAttribute(oAttribute): int
Checks for the provided sap.ui.core.tmpl.DOMAttribute in the aggregation attributes. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.core.tmpl.DOMAttribute}oAttribute The attribute whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
indexOfElement(oElement): int
Checks for the provided sap.ui.core.tmpl.DOMElement in the aggregation elements. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.core.tmpl.DOMElement}oElement The element whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertAttribute(oAttribute, iIndex): sap.ui.core.tmpl.DOMElement
Inserts a attribute into the aggregation attributes.
Parameters:
{sap.ui.core.tmpl.DOMAttribute}oAttribute the attribute to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the attribute should be inserted at; for a negative value of iIndex, the attribute is inserted at position 0; for a value greater than the current size of the aggregation, the attribute is inserted at the last position
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining
insertElement(oElement, iIndex): sap.ui.core.tmpl.DOMElement
Inserts a element into the aggregation elements.
Parameters:
{sap.ui.core.tmpl.DOMElement}oElement the element to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the element should be inserted at; for a negative value of iIndex, the element is inserted at position 0; for a value greater than the current size of the aggregation, the element is inserted at the last position
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining
removeAllAttributes(): sap.ui.core.tmpl.DOMAttribute[]
Removes all the controls from the aggregation attributes.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.ui.core.tmpl.DOMAttribute[]} An array of the removed elements (might be empty)
removeAllElements(): sap.ui.core.tmpl.DOMElement[]
Removes all the controls from the aggregation elements.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.ui.core.tmpl.DOMElement[]} An array of the removed elements (might be empty)
removeAttr(sName): sap.ui.core.tmpl.DOMElement
Removes the DOM attribute for the given name and returns the reference to this DOM element to support method chaining.
Parameters:
{string}sName The name of the DOM attribute.
Returns:
{sap.ui.core.tmpl.DOMElement}
removeAttribute(vAttribute): sap.ui.core.tmpl.DOMAttribute
Removes a attribute from the aggregation attributes.
Parameters:
{int|string|sap.ui.core.tmpl.DOMAttribute}vAttribute The attributeto remove or its index or id
Returns:
{sap.ui.core.tmpl.DOMAttribute} The removed attribute or null
removeElement(vElement): sap.ui.core.tmpl.DOMElement
Removes a element from the aggregation elements.
Parameters:
{int|string|sap.ui.core.tmpl.DOMElement}vElement The elementto remove or its index or id
Returns:
{sap.ui.core.tmpl.DOMElement} The removed element or null
Sets a new value for property tag.

The HTML-tag of the DOM element which contains the text

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

Default value is span.

Parameters:
{string}sTag New value for property tag
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining
Sets a new value for property text.

The text content of the DOM element

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

Parameters:
{string}sText New value for property text
Returns:
{sap.ui.core.tmpl.DOMElement} Reference to this in order to allow method chaining