Class sap.ui.model.ListBindingModule: sap/ui/model/ListBinding

extends Binding

The ListBinding is a specific binding for lists in the model, which can be used to populate Tables or ItemLists.

Constructor Summary
new sap.ui.model.ListBinding(oModel, sPath, oContext, aSorters?, aFilters?, mParameters?)Constructor for ListBinding
Method Summary
sap.ui.model.ListBinding.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.ListBinding with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.model.ListBinding.getMetadata()Returns a metadata object for class sap.ui.model.ListBinding.
filter(aFilters, sFilterType)Filters the list according to the filter definitions
getContexts(iStartIndex?, iLength?)Returns an array of binding contexts for the bound target list.
getCurrentContexts()Returns an array of currently used binding contexts of the bound control

This method does not trigger any data requests from the backend or delta calculation, but just returns the context array as last requested by the control.

getDistinctValues(sPath)Returns list of distinct values for the given relative binding path
getGroup(oContext)Gets the group for the given context.
getLength()Returns the number of entries in the list.
isGrouped()Indicates whether grouping is enabled for the binding.
isLengthFinal()Returns whether the length which can be retrieved using getLength() is a known, final length, or an preliminary or estimated length which may change if further data is requested.
sort(aSorters)Sorts the list according to the sorter object
attachFilter(fnFunction, oListener?)Attach event-handler fnFunction to the 'filter' event of this sap.ui.model.ListBinding.
attachSort(fnFunction, oListener?)Attach event-handler fnFunction to the 'sort' event of this sap.ui.model.ListBinding.
detachFilter(fnFunction, oListener?)Detach event-handler fnFunction from the 'filter' event of this sap.ui.model.ListBinding.
detachSort(fnFunction, oListener?)Detach event-handler fnFunction from the 'sort' event of this sap.ui.model.ListBinding.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.ListBinding(oModel, sPath, oContext, aSorters?, aFilters?, mParameters?)
Constructor for ListBinding
Parameters:
{sap.ui.model.Model}oModel
{string}sPath
{sap.ui.model.Context}oContext
{array}aSorters? initial sort order (can be either a sorter or an array of sorters)
{array}aFilters? predefined filter/s (can be either a filter or an array of filters)
{object}mParameters?
Method Detail
sap.ui.model.ListBinding.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.ListBinding 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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.model.ListBinding.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.ListBinding.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
filter(aFilters, sFilterType): sap.ui.model.ListBinding
Filters the list according to the filter definitions
Parameters:
{object[]}aFilters Array of filter objects
{sap.ui.model.FilterType}sFilterType Type of the filter which should be adjusted, if it is not given, the standard behaviour applies
Returns:
{sap.ui.model.ListBinding} returns this to facilitate method chaining
getContexts(iStartIndex?, iLength?): sap.ui.model.Context[]
Returns an array of binding contexts for the bound target list.

Note:The public usage of this method is deprecated, as calls from outside of controls will lead to unexpected side effects. For avoidance use sap.ui.model.ListBinding.prototype.getCurrentContexts instead.

Parameters:
{int}iStartIndex? the startIndex where to start the retrieval of contexts
{int}iLength?, Default: length of the list determines how many contexts to retrieve beginning from the start index.
Returns:
{sap.ui.model.Context[]} the array of contexts for each row of the bound list
getCurrentContexts(): sap.ui.model.Context[]
Returns an array of currently used binding contexts of the bound control

This method does not trigger any data requests from the backend or delta calculation, but just returns the context array as last requested by the control. This can be used by the application to get access to the data currently displayed by a list control.

Since:
1.28
Returns:
{sap.ui.model.Context[]} the array of contexts for each row of the bound list
getDistinctValues(sPath): Array
Returns list of distinct values for the given relative binding path
Parameters:
{string}sPath the relative binding path
Returns:
{Array} the array of distinct values.
getGroup(oContext): object
Gets the group for the given context. Must only be called if isGrouped() returns that grouping is enabled for this binding. The grouping will be performed using the first sorter (in case multiple sorters are defined).
Parameters:
{sap.ui.model.Context}oContext the binding context
Returns:
{object} the group object containing a key property and optional custom properties
See:
sap.ui.model.Sorter.getGroup
getLength(): int
Returns the number of entries in the list. This might be an estimated or preliminary length, in case the full length is not known yet, see method isLengthFinal().
Since:
1.24
Returns:
{int} returns the number of entries in the list
isGrouped(): boolean
Indicates whether grouping is enabled for the binding. Grouping is enabled for a list binding, if at least one sorter exists on the binding and the first sorter is a grouping sorter.
Returns:
{boolean} whether grouping is enabled
isLengthFinal(): boolean
Returns whether the length which can be retrieved using getLength() is a known, final length, or an preliminary or estimated length which may change if further data is requested.
Since:
1.24
Returns:
{boolean} returns whether the length is final
sort(aSorters): sap.ui.model.ListBinding
Sorts the list according to the sorter object
Parameters:
{sap.ui.model.Sorter|Array}aSorters the Sorter object or an array of sorters which defines the sort order
Returns:
{sap.ui.model.ListBinding} returns this to facilitate method chaining
attachFilter(fnFunction, oListener?)
Attach event-handler fnFunction to the 'filter' event of this sap.ui.model.ListBinding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
Deprecated:
use the change event. It now contains a parameter (reason : "filter") when a filter event is fired.
attachSort(fnFunction, oListener?)
Attach event-handler fnFunction to the 'sort' event of this sap.ui.model.ListBinding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
Deprecated:
use the change event. It now contains a parameter (reason : "sort") when a sorter event is fired.
detachFilter(fnFunction, oListener?)
Detach event-handler fnFunction from the 'filter' event of this sap.ui.model.ListBinding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
Deprecated:
use the change event.
detachSort(fnFunction, oListener?)
Detach event-handler fnFunction from the 'sort' event of this sap.ui.model.ListBinding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
Deprecated:
use the change event.