class sap.ui.core.tmpl.DOMElement

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/core/tmpl/DOMElement
Application Component: CA-UI5-COR

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


Constructor

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#constructor for a general description of the syntax of the settings object.

new sap.ui.core.tmpl.DOMElement(sId?, mSettings?)
Param Type Default Value Description
sId? string

id for the new control, generated automatically if no id is given

mSettings? object

initial settings for the new control


Properties

Name Type Default Value Description
tag string span

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

Visibility: public
text string

The text content of the DOM element

Visibility: public

Borrowed Properties

Name Type Default Value Description
blocked boolean false

Whether the control is currently in blocked state.

Visibility: public
busy boolean false

Whether the control is currently in busy state.

Visibility: public
busyIndicatorDelay int 1000

The delay in milliseconds, after which the busy indicator will show up for this control.

Visibility: public
busyIndicatorSize sap.ui.core.BusyIndicatorSize Medium

The size of the BusyIndicator. For controls with a width smaller 3rem a sap.ui.core.BusyIndicatorSize.Small should be used. If the size could vary in width and the width could get smaller than 3rem, the sap.ui.core.BusyIndicatorSize.Auto option could be used. The default is set to sap.ui.core.BusyIndicatorSize.Medium For a full screen BusyIndicator use sap.ui.core.BusyIndicatorSize.Large.

Since: 1.54.

Visibility: public
fieldGroupIds string[]

The IDs of a logical field group that this control belongs to.

All fields in a logical field group should share the same fieldGroupId. Once a logical field group is left, the validateFieldGroup event is fired.

For backward compatibility with older releases, field group IDs are syntactically not limited, but it is suggested to use only valid sap.ui.core.IDs.

See #attachValidateFieldGroup or consult the Field Group documentation.

Since: 1.31.

Visibility: public
visible boolean true

Whether the control should be visible on the screen.

If set to false, a placeholder will be rendered to mark the location of the invisible control in the DOM of the current page. The placeholder will be hidden and have zero dimensions (display: none).

Also see InvisibleRenderer.

Visibility: public

Aggregations

Default Aggregation: attributes

Name Cardinality Type Description
attributes (default) 0..n sap.ui.core.tmpl.DOMAttribute

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

elements 0..n sap.ui.core.tmpl.DOMElement

Nested DOM elements to support nested bindable structures

Borrowed Aggregations

Name Cardinality Type Description
customData 0..n sap.ui.core.CustomData

Custom Data, a data structure like a map containing arbitrary key value pairs.

dependents 0..n sap.ui.core.Element

Dependents are not rendered, but their databinding context and lifecycle are bound to the aggregating Element.

Since: 1.19.

dragDropConfig 0..n sap.ui.core.dnd.DragDropBase

Defines the drag-and-drop configuration. Note: This configuration might be ignored due to control metadata restrictions.

Since: 1.56.

layoutData 0..1 sap.ui.core.LayoutData

Defines the layout constraints for this control when it is used inside a Layout. LayoutData classes are typed classes and must match the embedding Layout. See VariantLayoutData for aggregating multiple alternative LayoutData instances to a single Element.

tooltip 0..1 sap.ui.core.TooltipBase

The tooltip that should be shown for this Element.

In the most simple case, a tooltip is a string that will be rendered by the control and displayed by the browser when the mouse pointer hovers over the control's DOM. In this variant, tooltip behaves like a simple control property.

Controls need to explicitly support this kind of tooltip as they have to render it, but most controls do. Exceptions will be documented for the corresponding controls (e.g. sap.ui.core.HTML does not support tooltips).

Alternatively, tooltip can act like a 0..1 aggregation and can be set to a tooltip control (an instance of a subclass of sap.ui.core.TooltipBase). In that case, the framework will take care of rendering the tooltip control in a popup-like manner. Such a tooltip control can display arbitrary content, not only a string.

UI5 currently does not provide a recommended implementation of TooltipBase as the use of content-rich tooltips is discouraged by the Fiori Design Guidelines. Existing subclasses of TooltipBase therefore have been deprecated. However, apps can still subclass from TooltipBase and create their own implementation when needed (potentially taking the deprecated implementations as a starting point).

See the section Using Tooltips in the Fiori Design Guideline.


Methods Overview

Method Description
addAttribute

Adds some attribute to the aggregation attributes.

addElement

Adds some element to the aggregation elements.

attr

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.

destroyAttributes

Destroys all the attributes in the aggregation attributes.

destroyElements

Destroys all the elements in the aggregation elements.

sap.ui.core.tmpl.DOMElement.extend

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.

getAttributes

Gets content of aggregation attributes.

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

getElements

Gets content of aggregation elements.

Nested DOM elements to support nested bindable structures

sap.ui.core.tmpl.DOMElement.getMetadata

Returns a metadata object for class sap.ui.core.tmpl.DOMElement.

getTag

Gets current value of property tag.

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

Default value is 'span'.

getText

Gets current value of property text.

The text content of the DOM element

indexOfAttribute

Checks for the provided sap.ui.core.tmpl.DOMAttribute in the aggregation attributes. and returns its index if found or -1 otherwise.

indexOfElement

Checks for the provided sap.ui.core.tmpl.DOMElement in the aggregation elements. and returns its index if found or -1 otherwise.

insertAttribute

Inserts a attribute into the aggregation attributes.

insertElement

Inserts a element into the aggregation elements.

removeAllAttributes

Removes all the controls from the aggregation attributes.

Additionally, it unregisters them from the hosting UIArea.

removeAllElements

Removes all the controls from the aggregation elements.

Additionally, it unregisters them from the hosting UIArea.

removeAttr

Removes the DOM attribute for the given name and returns the reference to this DOM element to support method chaining.

removeAttribute

Removes a attribute from the aggregation attributes.

removeElement

Removes a element from the aggregation elements.

setTag

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'.

setText

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.

addAttribute

Adds some attribute to the aggregation attributes.

Param Type DefaultValue Description
oAttribute sap.ui.core.tmpl.DOMAttribute

The attribute to add; if empty, nothing is inserted

addElement

Adds some element to the aggregation elements.

Param Type DefaultValue Description
oElement sap.ui.core.tmpl.DOMElement

The element to add; if empty, nothing is inserted

attr

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.

Param Type DefaultValue Description
sName string

The name of the DOM attribute.

sValue string

The value of the DOM attribute. If the value is undefined the DOM attribute will be removed.

destroyAttributes

Destroys all the attributes in the aggregation attributes.

destroyElements

Destroys all the elements in the aggregation elements.

sap.ui.core.tmpl.DOMElement.extend

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.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getAttributes

Gets content of aggregation attributes.

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

getElements

Gets content of aggregation elements.

Nested DOM elements to support nested bindable structures

sap.ui.core.tmpl.DOMElement.getMetadata

Returns a metadata object for class sap.ui.core.tmpl.DOMElement.

getTag

Gets current value of property tag.

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

Default value is 'span'.

getText

Gets current value of property text.

The text content of the DOM element

indexOfAttribute

Checks for the provided sap.ui.core.tmpl.DOMAttribute in the aggregation attributes. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oAttribute sap.ui.core.tmpl.DOMAttribute

The attribute whose index is looked for

indexOfElement

Checks for the provided sap.ui.core.tmpl.DOMElement in the aggregation elements. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oElement sap.ui.core.tmpl.DOMElement

The element whose index is looked for

insertAttribute

Inserts a attribute into the aggregation attributes.

Param Type DefaultValue Description
oAttribute sap.ui.core.tmpl.DOMAttribute

The attribute to insert; if empty, nothing is inserted

iIndex int

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

insertElement

Inserts a element into the aggregation elements.

Param Type DefaultValue Description
oElement sap.ui.core.tmpl.DOMElement

The element to insert; if empty, nothing is inserted

iIndex int

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

removeAllAttributes

Removes all the controls from the aggregation attributes.

Additionally, it unregisters them from the hosting UIArea.

removeAllElements

Removes all the controls from the aggregation elements.

Additionally, it unregisters them from the hosting UIArea.

removeAttr

Removes the DOM attribute for the given name and returns the reference to this DOM element to support method chaining.

Param Type DefaultValue Description
sName string

The name of the DOM attribute.

removeAttribute

Removes a attribute from the aggregation attributes.

Param Type DefaultValue Description
vAttribute int string sap.ui.core.tmpl.DOMAttribute

The attribute to remove or its index or id

removeElement

Removes a element from the aggregation elements.

Param Type DefaultValue Description
vElement int string sap.ui.core.tmpl.DOMElement

The element to remove or its index or id

setTag

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'.

Param Type DefaultValue Description
sTag string 'span'

New value for property tag

setText

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.

Param Type DefaultValue Description
sText string

New value for property text