The Tree
control provides a tree structure for displaying data in a hierarchy. Note: Growing feature is not supported by Tree
.
Constructor for a new Tree.
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.Tree(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 |
---|---|---|---|
enableBusyIndicator | boolean | true | When this property is set to |
footerText | string | Defines the footer text that appears in the control. Visibility: public |
|
growing | boolean | false | If set to |
growingDirection | sap.m.ListGrowingDirection | Downwards | Defines the direction of the growing feature. If set to |
growingScrollToLoad | boolean | false | If set to true, the user can scroll down/up to load more items. Otherwise a growing button is displayed at the bottom/top of the control. Note: This property can only be used if the |
growingThreshold | int | 20 | Defines the number of items to be requested from the model for each grow. This property can only be used if the |
growingTriggerText | string | Defines the text displayed on the growing button. The default is a translated text ("More") coming from the message bundle. This property can only be used if the |
|
headerDesign | sap.m.ListHeaderDesign | Standard | Defines the header style of the control. Possible values are |
headerText | string | Defines the header text that appears in the control. Note: If |
|
includeItemInSelection | boolean | false | Defines whether the items are selectable by clicking on the item itself ( |
inset | boolean | false | Defines the indentation of the container. Setting it to |
keyboardMode | sap.m.ListKeyboardMode | Navigation | Defines keyboard handling behavior of the control. |
mode | sap.m.ListMode | None | Defines the mode of the control (e.g. |
modeAnimationOn | boolean | true | Defines if animations will be shown while switching between modes. Visibility: public |
multiSelectMode | sap.m.MultiSelectMode | Default | Defines the multi-selection mode for the control. If this property is set to the Note: This property must be used with the |
noDataText | string | This text is displayed when the control contains no items. Visibility: public |
|
rememberSelections | boolean | true | If set to true, this control remembers and retains the selection of the items after a binding update has been performed (e.g. sorting, filtering). Note: This feature works only if two-way data binding for the |
showNoData | boolean | true | Defines whether or not the text specified in the |
showSeparators | sap.m.ListSeparators | All | Defines which item separator style will be used. Visibility: public |
showUnread | boolean | false | Activates the unread indicator for all items, if set to |
sticky | sap.m.Sticky[] | Defines the section of the control that remains fixed at the top of the page during vertical scrolling as long as the control is in the viewport. Note: Enabling sticky column headers in List controls will not have any effect. There are some known restrictions. A few are given below:
Since: 1.58.Visibility: public |
|
swipeDirection | sap.m.SwipeDirection | Both | Defines the direction of the swipe movement (e.g LeftToRight, RightToLeft, Both) to display the control defined in the |
width | sap.ui.core.CSSSize | 100% | Sets the width of the control. Visibility: public |
Name | Cardinality | Type | Description |
---|---|---|---|
contextMenu | 0..1 | sap.ui.core.IContextMenu |
Defines the context menu of the items. |
headerToolbar | 0..1 | sap.m.Toolbar |
The header area can be used as a toolbar to add extra controls for user interactions. Note: When set, this overwrites the |
infoToolbar | 0..1 | sap.m.Toolbar |
A toolbar that is placed below the header to show extra information to the user. |
items | 0..n | sap.m.ListItemBase |
Defines the items contained within this control. |
swipeContent | 0..1 | sap.ui.core.Control |
User can swipe to bring in this control on the right hand side of an item. Note:
|
Event | Description |
---|---|
toggleOpenState |
Fired when an item has been expanded or collapsed by user interaction. |
Fired when an item has been expanded or collapsed by user interaction.
Since: 1.50.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
itemIndex | int |
Index of the expanded/collapsed item |
itemContext | object |
Binding context of the item |
expanded | boolean |
Flag that indicates whether the item has been expanded or collapsed |
Method | Description |
---|---|
attachToggleOpenState |
Attaches event handler When called, the context of the event handler (its Fired when an item has been expanded or collapsed by user interaction. |
collapse |
Collapses one or multiple items. |
collapseAll |
Collapses all nodes. |
detachToggleOpenState |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
expand |
Expands one or multiple items. Note that items that are hidden at the time of calling this API can't be expanded. |
expandToLevel |
Defines the level to which the tree is expanded. The function can be used to define the initial expanding state. An alternative way to define the initial expanding state is to set the parameter Example: oTree.bindItems({ path: "...", parameters: { numberOfExpandedLevels: 1 } }); |
sap.m.Tree.extend |
Creates a new subclass of class sap.m.Tree with name
|
fireToggleOpenState |
Fires event toggleOpenState to attached listeners. |
sap.m.Tree.getMetadata |
Returns a metadata object for class sap.m.Tree. |
setGrowing |
The |
setGrowingDirection |
The |
setGrowingScrollToLoad |
The |
setGrowingThreshold |
The |
setGrowingTriggerText |
The |
Attaches event handler fnFunction
to the toggleOpenState event of this sap.m.Tree
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.m.Tree
itself.
Fired when an item has been expanded or collapsed by user interaction.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Collapses one or multiple items.
Param | Type | DefaultValue | Description |
---|---|---|---|
vParam | int int[] |
The index or indices of the tree items to be collapsed |
Detaches event handler fnFunction
from the toggleOpenState event of this sap.m.Tree
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Expands one or multiple items. Note that items that are hidden at the time of calling this API can't be expanded.
Param | Type | DefaultValue | Description |
---|---|---|---|
vParam | int int[] |
The index or indices of the item to be expanded |
Defines the level to which the tree is expanded. The function can be used to define the initial expanding state. An alternative way to define the initial expanding state is to set the parameter numberOfExpandedLevels
of the binding.
Example:
oTree.bindItems({ path: "...", parameters: { numberOfExpandedLevels: 1 } });
Param | Type | DefaultValue | Description |
---|---|---|---|
iLevel | int |
The level to which the data is expanded |
Creates a new subclass of class sap.m.Tree with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.m.ListBase.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 |
Fires event toggleOpenState to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
itemIndex | int |
Index of the expanded/collapsed item |
|
itemContext | object |
Binding context of the item |
|
expanded | boolean |
Flag that indicates whether the item has been expanded or collapsed |
The growing
property is not supported for control Tree
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bValue | boolean |
New value for the |
The growingDirection
property is not supported for control Tree
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sValue | sap.m.ListGrowingDirection |
New value for the |
The growingScrollToLoad
property is not supported for control Tree
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bValue | boolean |
New value for the |