abstract class sap.ui.model.TreeBinding

Control sample: sap.ui.model.TreeBinding
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/model/TreeBinding
Application Component: CA-UI5-COR

The TreeBinding is a specific binding for trees in the model, which can be used to populate Trees.


Constructor

Constructor for TreeBinding.

This constructor should only be called by subclasses or model implementations, not by application or control code. Such code should use Model#bindTree on the corresponding model instead.

new sap.ui.model.TreeBinding(oModel, sPath, oContext?, aFilters?, mParameters?, aSorters?)
Param Type Default Value Description
oModel sap.ui.model.Model

Model instance that this binding is created for and that it belongs to

sPath string

Path pointing to the tree / array that should be bound

oContext? object

Context object for this binding (optional)

aFilters? sap.ui.model.Filter sap.ui.model.Filter[]

Predefined filter or an array of filters (optional)

mParameters? string

Additional model specific parameters (optional)

aSorters? sap.ui.model.Sorter sap.ui.model.Sorter[]

Predefined sorter or an array of sorters (optional)


Methods Overview

Method Description
attachFilter

Attaches event handler fnFunction to the _filter event of this sap.ui.model.TreeBinding.

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.ui.model.TreeBinding itself.

Since 1.11 use the <code>change</code> event. It now contains a parameter <code>(reason : "filter")</code> when a filter event is fired.
detachFilter

Detaches event handler fnFunction from the _filter event of this sap.ui.model.TreeBinding.

The passed function and listener object must match the ones used for event registration.

Since 1.11 use the <code>change</code> event.
sap.ui.model.TreeBinding.extend

Creates a new subclass of class sap.ui.model.TreeBinding 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.model.Binding.extend.

filter

Filters the tree according to the filter definitions.

getChildCount

Returns the number of child nodes of a specific context

getFilterInfo

Return the filter information as an AST. The default implementation checks for this.oCombinedFilter, models not using this member may override the method. Consumers must not rely on the origin information to be available, future filter implementations will not provide this information.

sap.ui.model.TreeBinding.getMetadata

Returns a metadata object for class sap.ui.model.TreeBinding.

getNodeContexts

Returns the current value of the bound target

getRootContexts

Returns the current value of the bound target

hasChildren

Returns if the node has child nodes

sort

Sorts the tree according to the sorter definitions.

attachFilter

Attaches event handler fnFunction to the _filter event of this sap.ui.model.TreeBinding.

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.ui.model.TreeBinding itself.

Since 1.11 use the <code>change</code> event. It now contains a parameter <code>(reason : "filter")</code> when a filter event is fired.
Param Type DefaultValue Description
fnFunction function

The function to be called, when the event occurs

oListener object

Context object to call the event handler with, defaults to this TreeBinding itself

detachFilter

Detaches event handler fnFunction from the _filter event of this sap.ui.model.TreeBinding.

The passed function and listener object must match the ones used for event registration.

Since 1.11 use the <code>change</code> event.
Param Type DefaultValue Description
fnFunction function

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.model.TreeBinding.extend

Creates a new subclass of class sap.ui.model.TreeBinding 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.model.Binding.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

filter

Filters the tree according to the filter definitions.

Param Type DefaultValue Description
aFilters sap.ui.model.Filter sap.ui.model.Filter[]

Single sap.ui.model.Filter object or an array of filter objects

sFilterType sap.ui.model.FilterType

Type of the filter which should be adjusted, if it is not given, the standard behaviour applies

getChildCount

Returns the number of child nodes of a specific context

Param Type DefaultValue Description
oContext Object

the context element of the node

getFilterInfo

Return the filter information as an AST. The default implementation checks for this.oCombinedFilter, models not using this member may override the method. Consumers must not rely on the origin information to be available, future filter implementations will not provide this information.

Param Type DefaultValue Description
bIncludeOrigin boolean

include information about the filter objects the tree has been created from

sap.ui.model.TreeBinding.getMetadata

Returns a metadata object for class sap.ui.model.TreeBinding.

getNodeContexts

Returns the current value of the bound target

Param Type DefaultValue Description
oContext sap.ui.model.Context

the context element of the node

iStartIndex int

the startIndex where to start the retrieval of contexts

iLength int

determines how many contexts to retrieve beginning from the start index.

getRootContexts

Returns the current value of the bound target

Param Type DefaultValue Description
iStartIndex int

the startIndex where to start the retrieval of contexts

iLength int

determines how many contexts to retrieve beginning from the start index.

hasChildren

Returns if the node has child nodes

Param Type DefaultValue Description
oContext Object

the context element of the node

sort

Sorts the tree according to the sorter definitions.

Param Type DefaultValue Description
aSorters sap.ui.model.Sorter[]

Array of sap.ui.model.Sorter objects