DevExtreme jQuery - ODataStore Options
beforeSend
Name | Type | Description |
---|---|---|
async |
Indicates whether the request is asynchronous or synchronous. |
|
headers |
The request headers. |
|
method |
The request method ("GET", "POST", "PATCH", or "MERGE"). |
|
params |
Additional request parameters. |
|
payload |
The request body; for example, when updating an item, this property holds an object with new values. |
|
timeout |
The request timeout. |
|
url |
The request URL. |
deserializeDates
ODataStore can parse date-time values in ISO8601 format (for example, "2016-07-13T16:05:00.000Z"
) or Microsoft format (for instance, "/Date(1198908717056)/"
). In the first case, the store ignores the timezone modifier (usually Z
) when parsing the value. In the second case, the store adds the time-zone offset to the value according to the client's time-zone.
Disabling deserialization may cause filtering issues in UI components bound to the ODataStore. When deserialization is disabled in the store, date-time strings are converted to Date objects at the UI component level. When filtering, the UI component reverts an entered date-time value to a string based on the dateSerializationFormat property's value and passes the string to the ODataStore for further processing. OData does not support strings which cause filtering to fail.
To prevent these issues, the store's deserializeDates property should be set to true or set the UI component's dateSerializationFormat property to null.
errorHandler
A JavaScript Error object extended with the following fields:
Name | Type | Description |
---|---|---|
errorDetails |
Error details. It is an OData error response object for OData-specific errors or a jqXHR object for other errors when you use jQuery. |
|
httpStatus |
The error code. |
|
requestOptions |
Request details. Contains the following fields:
|
fieldTypes
Specifies the data field types. Accepts the following types: "String", "Int32", "Int64", "Boolean", "Single", "Decimal" and "Guid".
Set this property if you are going to filter data. An object assigned to it should list data fields and their types as field-value pairs. You can also use this property instead of the keyType to specify the key property's type.
filterToLower
Specifies whether to convert string values to lowercase in filter and search requests. Applies to the following operations: "startswith", "endswith", "contains", and "notcontains".
Defaults to the global oDataFilterToLower setting.
When this property is true, the filter expression sent to the server contains a tolower()
function call and a lowercase filter value.
- var ds = new DevExpress.data.DataSource({
- store: new DevExpress.data.ODataStore({
- url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
- key: "Product_ID",
- filterToLower: true
- }),
- filter: ["Product_Name", "startswith", "Tel"]
- });
- // The filter expression in the request looks like the following:
- // https://...?filter=startswith(tolower(Product_Name), 'tel')
key
Specifies the key property (or properties) that provide(s) key values to access data items. Each key value must be unique.
keyType
Set this property if you do not need to filter data. Otherwise, use the fieldTypes property. In the following code, the Product_ID
and Product_Code
key properties are Guid
and Int32
, respectively:
- var store = new DevExpress.data.ODataStore({
- url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
- key: [ "Product_ID", "Product_Code" ],
- keyType: {
- Product_ID: "Guid",
- Product_Code: "Int32"
- }
- });
version
If the version is 2, the ODataContext uses the "MERGE" method to send requests; otherwise, it uses "PATCH". Set the method field of the beforeSend function's parameter to override this behavior.
withCredentials
Specifies whether to send cookies, authorization headers, and client certificates in a cross-origin request.
This property's value is passed to the underlying jqXHR object.
Use the beforeSend function to set custom authorization headers.