The ExpandableText
control can be used to display long texts inside a table, list or form.
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.
When to use
When not to use
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 |
Name | Type | Default Value | Description |
---|---|---|---|
emptyIndicatorMode | sap.m.EmptyIndicatorMode | Off | Specifies if an empty indicator should be displayed when there is no text. |
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 |
Default Aggregation:
Name | Cardinality | Type | Description |
---|---|---|---|
_showMoreLink | 0..1 | sap.m.Link |
The "More" link. |
Method | Description |
---|---|
bindText |
Binds property text to model data. See ManagedObject.bindProperty for a detailed description of the possible properties of |
sap.m.ExpandableText.extend |
Creates a new subclass of class sap.m.ExpandableText with name
|
getAccessibilityInfo |
Gets the accessibility information for the text.
|
getEmptyIndicatorMode |
Gets current value of property emptyIndicatorMode. Specifies if an empty indicator should be displayed when there is no text. Default value is |
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 |
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 |
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 |
getText |
Gets the text. |
getTextAlign |
Gets current value of property textAlign. Sets the horizontal alignment of the text. Default value is |
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 |
getTextDomRef |
Returns the text node container's DOM reference. This can be different from |
getWrappingType |
Gets current value of property wrappingType. Defines the type of text wrapping to be used (hyphenated or normal). Default value is |
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 Default value is |
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 Default value is |
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 Default value is |
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 Default value is |
setText |
Sets a new value for property text. Determines the text to be displayed. When called with a value of Default value is |
setTextAlign |
Sets a new value for property textAlign. Sets the horizontal alignment of the text. When called with a value of Default value is |
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 Default value is |
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 Default value is |
unbindText |
Unbinds property text from model data. |
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 |
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 |
Gets the accessibility information for the text.
References:
Gets current value of property emptyIndicatorMode.
Specifies if an empty indicator should be displayed when there is no text.
Default value is Off
.
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
.
Gets current value of property overflowMode.
Determines how the full text will be displayed - InPlace or Popover
Default value is InPlace
.
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
.
Gets the text.
Param | Type | DefaultValue | Description |
---|---|---|---|
bNormalize | boolean |
Indication for normalized text. |
Gets current value of property textAlign.
Sets the horizontal alignment of the text.
Default value is Begin
.
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
.
Returns the text node container's DOM reference. This can be different from getDomRef
when inner wrapper is needed.
Gets current value of property wrappingType.
Defines the type of text wrapping to be used (hyphenated or normal).
Default value is Normal
.
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |