loio |
---|
1ab4f62de6ab467096a2a98b363a1373 |
view on: demo kit nightly build | demo kit latest release
When creating a binding, you can provide a parameter map which can contain the following:
-
OData query options; the values determine parameters for data service requests initiated by the binding. For more information about these options, see OData Version 4.0 Part 2: URL Conventions, 5 Query Options.
-
Binding-specific parameters start with
"$$"
and influence the behavior of the binding as follows: -
$$canonicalPath
: Set totrue
to use the canonical path computed from the path of the binding's context in the read URL for data service requests. All values other thantrue
lead to an error.
-
$$groupId
and$$updateGroupId
: see Batch Control -
$$noPatch
: In a property binding, set totrue
to prevent changes of the value to appear in back-end requests. -
$$ownRequest
: Set totrue
to ensure the binding uses an own service request to read data. All values other thantrue
lead to an error. -
$$patchWithoutSideEffects
: Set totrue
to switch off implicit loading of side effects via PATCH requests. This sets the"return=minimal" preference and requires the service to return an ETag header for "204 No Content" responses. If not specified, the value of the parent binding is used. All values other thantrue
lead to an error. -
$$inheritExpandSelect
: For operation bindings only. Set totrue
to ensure that $expand and $select from the parent binding are used in the request sent on#invoke
. If set totrue
, the binding must not set the $expand itself, the operation must be bound, and the return value and the binding parameter must belong to the same entity set.
The binding's OData query options are combined with the query options passed to the OData V4 model; the binding's query options overwrite model query options with the same name. The resulting query options are appended to each data service request by this binding. The following query options are supported; all others are not allowed and lead to an error:
-
OData custom query options except those with the name prefix
"sap-"
(unless starting with"sap-valid-"
, which can be used for Temporal Data). For more information about these, see OData Version 4.0 Part 2: URL Conventions, 5.2 Custom Query Options. -
The list and context binding support the OData system query options
$apply
,$count
,$expand
,$filter
,$orderby
,$search
and$select
. -
An absolute property binding with a path that ends on "$count" supports the OData system query options
$apply
,$filter
, and$search
.
The query option $count
must be specified as a boolean value with true
or false
. All other query options can be specified with a string value. In addition to strings, the following alternatives are possible:
-
$select
can be specified as an array of strings where each string specifies a select item, or the value '*
' to select all properties. Normally, these items point to direct parts of the query result without further expanding into related entities.Further options are available with Automatic determination of $expand and $select. -
$expand
can be an object where each object property corresponds to an expand item: the key is the complete expand path. The value can be set as follows:a)
true
ornull
if noexpand
options are requiredb) An object with query options for the
$expand
; numeric options (like$levels
) may be given as numbers. If the option is$expand
or$select
, the value may again be an object or array.
Example: Binding with parameters in JavaScript
oView.byId("SalesOrderTable").bindItems({
path : "/SalesOrderList",
parameters : {
"$count" : true,
"$expand" : {
"SO_2_SOITEM" : {
"$orderby" : "ItemPosition",
"$select" : ["ItemPosition", "Quantity", "QuantityUnit", "SalesOrderID"]
}
},
"$filter" : "BuyerName ge 'M'",
"$orderby" : "GrossAmount desc",
"$select" : ["BuyerName", "CurrencyCode", "GrossAmount", "Note", "SalesOrderID"]
}
});
Example: Binding with parameters in an XML view ($select
and $expand
values as string)
<Table growing="true" growingThreshold="5" id="SalesOrders"
items="{
path : '/SalesOrderList',
parameters : {
$count : true,
$expand : 'SO_2_BP',
$filter : 'BuyerName ge \'M\'',
$orderby : 'GrossAmount desc',
$select : 'BuyerName,CurrencyCode,GrossAmount,Note,SalesOrderID'
},
}">
Example: Binding with parameters in an XML view ($select
and $expand
values as object)
<Table growing="true" growingThreshold="5" id="SalesOrders"
items="{
path : '/SalesOrderList',
parameters : {
$count : true,
$expand : {
'SO_2_SOITEM' : {
'$orderby' : 'ItemPosition',
'$select' : ['ItemPosition','Quantity','QuantityUnit','SalesOrderID']
}
},
$filter : 'BuyerName ge \'M\'',
$orderby : 'GrossAmount desc',
$select : ['BuyerName','CurrencyCode','GrossAmount','Note','SalesOrderID']
},
}">
changeParameters
allows to change, add, or delete OData query options. This does not apply, however, to binding-specific parameters that start with $$
.
The parameters are changed according to the given map of parameters: Parameters with an undefined value are removed, the other parameters are set, and missing parameters remain unchanged. Change, add or delete is possible at the same time. The binding is refreshed as soon as the parameter changes are applied.
Example: Change binding parameters in JavaScript
oView.byId("SalesOrderTable").getBinding("items").changeParameters({
"$search" : '"mountain bike"',
"$filter" : undefined
});