class sap.ui.model.odata.v2.ODataListBinding

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/model/odata/v2/ODataListBinding
Application Component: CA-UI5-COR

List binding implementation for OData format.


Constructor

new sap.ui.model.odata.v2.ODataListBinding(oModel, sPath, oContext, aSorters?, aFilters?, mParameters?)
Param Type Default Value Description
oModel sap.ui.model.odata.v2.ODataModel

Model that this list binding belongs to

sPath string

Path into the model data, relative to the given oContext

oContext sap.ui.model.Context

Context that the sPath is based on

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

Initial sort order, can be either a sorter or an array of sorters

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

Predefined filters, can be either a filter or an array of filters

mParameters? object

A map which contains additional parameters for the binding

batchGroupId? string

Sets the batch group ID to be used for requests originating from this binding

countMode? sap.ui.model.odata.CountMode

Defines the count mode of this binding; if not specified, the default count mode of the oModel is applied

createdEntitiesKey? string ""

A key used in combination with the resolved path of this binding to identify the entities created this binding's #create method.

Note: Different controls or control aggregation bindings to the same collection must have different createdEntitiesKey values.

custom? Object<string,string>

An optional map of custom query parameters. Custom parameters must not start with $

expand? string

Value for the OData $expand query parameter which is included in the request

faultTolerant? boolean

Turns on the fault tolerance mode, data is not reset if a back-end request returns an error

operationMode? sap.ui.model.odata.OperationMode

Defines the operation mode of this binding

select? string

Value for the OData $select query parameter which is included in the request

threshold? int

Threshold that defines how many entries should be fetched at least by the binding if operationMode is set to Auto (See documentation for sap.ui.model.odata.OperationMode.Auto)

transitionMessagesOnly? boolean

Whether this list binding only requests transition messages from the back end. If messages for entities of this collection need to be updated, use sap.ui.model.odata.v2.ODataModel#read on the parent entity corresponding to this list binding's context with the parameter updateAggregatedMessages set to true.

usePreliminaryContext? boolean

Whether a preliminary context will be used. When set to true, the model can bundle the OData calls for dependent bindings into fewer $batch requests. For more information, see Optimizing Dependent Bindings


Methods Overview

Method Description
create

The function is experimental and the API/behaviour is not finalized and hence this must not be used for productive usage.

Creates a new entity via sap.ui.model.odata.v2.ODataModel#createEntry and inserts it at the start of the list.

Note: If there are transient entities in the list, switching the parent context is not supported. The transient entities are stored at the ListBinding only, that means if a table is rebound, that is the list binding is replaced by a new instance, the newly created entities are not visible any more. Nevertheless they still exist and the corresponding requests are fired with the next call of #submitChanges.

Note: The metadata have to be loaded before #create can be called.

sap.ui.model.odata.v2.ODataListBinding.extend

Creates a new subclass of class sap.ui.model.odata.v2.ODataListBinding 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.ListBinding.extend.

filter

Filters the list.

When using sap.ui.model.Filter the filters are first grouped according to their binding path. All filters belonging to the same group are combined with OR and after that the results of all groups are combined with AND. Usually this means, all filters applied to a single table column are combined with OR, while filters on different table columns are combined with AND. Please note that a custom filter function is only supported with operation mode sap.ui.model.odata.OperationMode.Client.

getContexts

Return contexts for the list.

getDownloadUrl

Get a download URL with the specified format considering the sort/filter/custom parameters.

getLength

Return the length of the list.

In case the final length is unknown (e.g. when searching on a large dataset), this will return an estimated length.

sap.ui.model.odata.v2.ODataListBinding.getMetadata

Returns a metadata object for class sap.ui.model.odata.v2.ODataListBinding.

initialize

Initialize binding.

Fires a change if data is already available ($expand) or a refresh. If metadata is not yet available, do nothing, method will be called again when metadata is loaded.

refresh

Refreshes the binding, check whether the model data has been changed and fire change event if this is the case. For server side models this should refetch the data from the server. To update a control, even if no data has been changed, e.g. to reset a control after failed validation, use the parameter bForceUpdate.

requestFilterForMessages

Requests a sap.ui.model.Filter object which can be used to filter the list binding by entries with model messages. With the filter callback, you can define if a message is considered when creating the filter for entries with messages.

The resulting filter does not consider application or control filters specified for this list binding in its constructor or in its #filter method; add filters which you want to keep with the "and" conjunction to the resulting filter before calling #filter.

sort

Sorts the list.

create

The function is experimental and the API/behaviour is not finalized and hence this must not be used for productive usage.

Creates a new entity via sap.ui.model.odata.v2.ODataModel#createEntry and inserts it at the start of the list.

Note: If there are transient entities in the list, switching the parent context is not supported. The transient entities are stored at the ListBinding only, that means if a table is rebound, that is the list binding is replaced by a new instance, the newly created entities are not visible any more. Nevertheless they still exist and the corresponding requests are fired with the next call of #submitChanges.

Note: The metadata have to be loaded before #create can be called.

Param Type DefaultValue Description
oInitialData object {}

The initial data for the created entity; see mParameters.properties parameter of sap.ui.model.odata.v2.ODataModel#createEntry

bAtEnd boolean false

Whether the entity is inserted at the end of the list. When creating multiple entities, this parameter must have the same value for each entity.

mParameters object

A map of parameters as specified for sap.ui.model.odata.v2.ODataModel#createEntry where only the following subset of these is supported.

changeSetId string

The ID of the ChangeSet that this request should belong to

error function

The error callback function

expand string

A comma-separated list of navigation properties to be expanded for the newly created entity; see sap.ui.model.odata.v2.ODataModel#createEntry

groupId string

The ID of a request group; requests belonging to the same group will be bundled in one batch request

success function

The success callback function

sap.ui.model.odata.v2.ODataListBinding.extend

Creates a new subclass of class sap.ui.model.odata.v2.ODataListBinding 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.ListBinding.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 list.

When using sap.ui.model.Filter the filters are first grouped according to their binding path. All filters belonging to the same group are combined with OR and after that the results of all groups are combined with AND. Usually this means, all filters applied to a single table column are combined with OR, while filters on different table columns are combined with AND. Please note that a custom filter function is only supported with operation mode sap.ui.model.odata.OperationMode.Client.

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

Single filter or array of filter objects

sFilterType sap.ui.model.FilterType Control

Type of the filter which should be adjusted. If it is not given, type Control is assumed

bReturnSuccess boolean false

Whether the success indicator should be returned instead of this

getContexts

Return contexts for the list.

Param Type DefaultValue Description
iStartIndex int

The start index of the requested contexts

iLength int

The requested amount of contexts

iThreshold int

The threshold value

getDownloadUrl

Get a download URL with the specified format considering the sort/filter/custom parameters.

Param Type DefaultValue Description
sFormat string

Value for the $format Parameter

getLength

Return the length of the list.

In case the final length is unknown (e.g. when searching on a large dataset), this will return an estimated length.

sap.ui.model.odata.v2.ODataListBinding.getMetadata

Returns a metadata object for class sap.ui.model.odata.v2.ODataListBinding.

initialize

Initialize binding.

Fires a change if data is already available ($expand) or a refresh. If metadata is not yet available, do nothing, method will be called again when metadata is loaded.

refresh

Refreshes the binding, check whether the model data has been changed and fire change event if this is the case. For server side models this should refetch the data from the server. To update a control, even if no data has been changed, e.g. to reset a control after failed validation, use the parameter bForceUpdate.

Param Type DefaultValue Description
bForceUpdate boolean

Update the bound control even if no data has been changed

sGroupId string

The group Id for the refresh

requestFilterForMessages

Requests a sap.ui.model.Filter object which can be used to filter the list binding by entries with model messages. With the filter callback, you can define if a message is considered when creating the filter for entries with messages.

The resulting filter does not consider application or control filters specified for this list binding in its constructor or in its #filter method; add filters which you want to keep with the "and" conjunction to the resulting filter before calling #filter.

Param Type DefaultValue Description
fnFilter function(sap.ui.core.message.Message) : boolean

A callback function to filter only relevant messages. The callback returns whether the given sap.ui.core.message.Message is considered. If no callback function is given, all messages are considered.

sort

Sorts the list.

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

A new sorter or an array of sorters which define the sort order

bReturnSuccess boolean false

Whether the success indicator should be returned instead of this