class sap.m.ExpandableText

Control sample: sap.m.ExpandableText
Visiblity: public
UX Guidelines:
Implements: sap.ui.core.IFormContentsap.m.IHyphenation
Available since: N/A
Module: sap/m/ExpandableText
Application Component: CA-UI5-CTR

The ExpandableText control can be used to display long texts inside a table, list or form.

Overview

Only the first characters from the text field are shown initially and a "More" link which allows the full text to be displayed. The overflowMode property determines if the full text will be displayed expanded in place (default) or in a popover. If the text is expanded a "Less" link is displayed, which allows collapsing the text field.

Usage

When to use

When not to use


Constructor

Constructor for a new ExpandableText.

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.m.ExpandableText(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
emptyIndicatorMode sap.m.EmptyIndicatorMode Off

Specifies if an empty indicator should be displayed when there is no text.

Since: 1.91.

Visibility: public
expanded boolean false

Determines if the text is expanded.

Visibility: hidden
maxCharacters int 100

Specifies the maximum number of characters from the beginning of the text field that are shown initially.

Visibility: public
overflowMode sap.m.ExpandableTextOverflowMode InPlace

Determines how the full text will be displayed - InPlace or Popover

Visibility: public
renderWhitespace boolean false

Specifies how whitespace and tabs inside the control are handled. If true, whitespace will be preserved by the browser.

Visibility: public
text string empty string

Determines the text to be displayed.

Visibility: public
textAlign sap.ui.core.TextAlign Begin

Sets the horizontal alignment of the text.

Visibility: public
textDirection sap.ui.core.TextDirection Inherit

Available options for the text direction are left-to-right (LTR) and right-to-left (RTL) By default the control inherits the text direction from its parent control.

Visibility: public
wrappingType sap.m.WrappingType Normal

Defines the type of text wrapping to be used (hyphenated or normal).

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description

Methods Overview

Method Description
bindText

Binds property text to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

sap.m.ExpandableText.extend

Creates a new subclass of class sap.m.ExpandableText 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.

getAccessibilityInfo

Gets the accessibility information for the text.

References:

  • sap.ui.core.Control#getAccessibilityInfo

getEmptyIndicatorMode

Gets current value of property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

Default value is Off.

getMaxCharacters

Gets current value of property maxCharacters.

Specifies the maximum number of characters from the beginning of the text field that are shown initially.

Default value is 100.

sap.m.ExpandableText.getMetadata

Returns a metadata object for class sap.m.ExpandableText.

getOverflowMode

Gets current value of property overflowMode.

Determines how the full text will be displayed - InPlace or Popover

Default value is InPlace.

getRenderWhitespace

Gets current value of property renderWhitespace.

Specifies how whitespace and tabs inside the control are handled. If true, whitespace will be preserved by the browser.

Default value is false.

getText

Gets the text.

getTextAlign

Gets current value of property textAlign.

Sets the horizontal alignment of the text.

Default value is Begin.

getTextDirection

Gets current value of property textDirection.

Available options for the text direction are left-to-right (LTR) and right-to-left (RTL) By default the control inherits the text direction from its parent control.

Default value is Inherit.

getTextDomRef

Returns the text node container's DOM reference. This can be different from getDomRef when inner wrapper is needed.

getWrappingType

Gets current value of property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

Default value is Normal.

setEmptyIndicatorMode

Sets a new value for property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

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

Default value is Off.

setMaxCharacters

Sets a new value for property maxCharacters.

Specifies the maximum number of characters from the beginning of the text field that are shown initially.

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

Default value is 100.

setOverflowMode

Sets a new value for property overflowMode.

Determines how the full text will be displayed - InPlace or Popover

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

Default value is InPlace.

setRenderWhitespace

Sets a new value for property renderWhitespace.

Specifies how whitespace and tabs inside the control are handled. If true, whitespace will be preserved by the browser.

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

Default value is false.

setText

Sets a new value for property text.

Determines the text to be displayed.

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

Default value is empty string.

setTextAlign

Sets a new value for property textAlign.

Sets the horizontal alignment of the text.

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

Default value is Begin.

setTextDirection

Sets a new value for property textDirection.

Available options for the text direction are left-to-right (LTR) and right-to-left (RTL) By default the control inherits the text direction from its parent control.

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

Default value is Inherit.

setWrappingType

Sets a new value for property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

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

Default value is Normal.

unbindText

Unbinds property text from model data.

bindText

Binds property text to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

Param Type DefaultValue Description
oBindingInfo sap.ui.base.ManagedObject.PropertyBindingInfo

The binding information

sap.m.ExpandableText.extend

Creates a new subclass of class sap.m.ExpandableText 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

getAccessibilityInfo

Gets the accessibility information for the text.

References:

getEmptyIndicatorMode

Gets current value of property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

Default value is Off.

getMaxCharacters

Gets current value of property maxCharacters.

Specifies the maximum number of characters from the beginning of the text field that are shown initially.

Default value is 100.

sap.m.ExpandableText.getMetadata

Returns a metadata object for class sap.m.ExpandableText.

getOverflowMode

Gets current value of property overflowMode.

Determines how the full text will be displayed - InPlace or Popover

Default value is InPlace.

getRenderWhitespace

Gets current value of property renderWhitespace.

Specifies how whitespace and tabs inside the control are handled. If true, whitespace will be preserved by the browser.

Default value is false.

getText

Gets the text.

Param Type DefaultValue Description
bNormalize boolean

Indication for normalized text.

getTextAlign

Gets current value of property textAlign.

Sets the horizontal alignment of the text.

Default value is Begin.

getTextDirection

Gets current value of property textDirection.

Available options for the text direction are left-to-right (LTR) and right-to-left (RTL) By default the control inherits the text direction from its parent control.

Default value is Inherit.

getTextDomRef

Returns the text node container's DOM reference. This can be different from getDomRef when inner wrapper is needed.

getWrappingType

Gets current value of property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

Default value is Normal.

setEmptyIndicatorMode

Sets a new value for property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

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

Default value is Off.

Param Type DefaultValue Description
sEmptyIndicatorMode sap.m.EmptyIndicatorMode Off

New value for property emptyIndicatorMode

setMaxCharacters

Sets a new value for property maxCharacters.

Specifies the maximum number of characters from the beginning of the text field that are shown initially.

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

Default value is 100.

Param Type DefaultValue Description
iMaxCharacters int 100

New value for property maxCharacters

setOverflowMode

Sets a new value for property overflowMode.

Determines how the full text will be displayed - InPlace or Popover

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

Default value is InPlace.

Param Type DefaultValue Description
sOverflowMode sap.m.ExpandableTextOverflowMode InPlace

New value for property overflowMode

setRenderWhitespace

Sets a new value for property renderWhitespace.

Specifies how whitespace and tabs inside the control are handled. If true, whitespace will be preserved by the browser.

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

Default value is false.

Param Type DefaultValue Description
bRenderWhitespace boolean false

New value for property renderWhitespace

setText

Sets a new value for property text.

Determines the text to be displayed.

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

Default value is empty string.

Param Type DefaultValue Description
sText string ''

New value for property text

setTextAlign

Sets a new value for property textAlign.

Sets the horizontal alignment of the text.

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

Default value is Begin.

Param Type DefaultValue Description
sTextAlign sap.ui.core.TextAlign Begin

New value for property textAlign

setTextDirection

Sets a new value for property textDirection.

Available options for the text direction are left-to-right (LTR) and right-to-left (RTL) By default the control inherits the text direction from its parent control.

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

Default value is Inherit.

Param Type DefaultValue Description
sTextDirection sap.ui.core.TextDirection Inherit

New value for property textDirection

setWrappingType

Sets a new value for property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

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

Default value is Normal.

Param Type DefaultValue Description
sWrappingType sap.m.WrappingType Normal

New value for property wrappingType

unbindText

Unbinds property text from model data.