This section describes the ODataStore's configuration properties.
Specifies a function that customizes the request before it is sent to the server.
Function parameters:The request parameters.
Object structure:
Name Type Description asyncIndicates whether the request is asynchronous or synchronous.
headersThe request headers.
methodThe request method ("GET", "POST", "PATCH", or "MERGE").
paramsAdditional request parameters.
payloadThe request body; for example, when updating an item, this property holds an object with new values.
Unavailable if the request method is "GET".
The request timeout.
urlThe request URL.
jQueryvar store = new DevExpress.data.ODataStore({ url: "https://js.devexpress.com/Demos/DevAV/odata/Products", beforeSend: function (e) { e.params = { "param1": "value1", "param2": "value2" }; e.headers = { "Custom Header": "value" }; } });Angular
import ODataStore from "devextreme/data/odata/store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ url: "https://js.devexpress.com/Demos/DevAV/odata/Products", beforeSend: (e) => { e.params = { "param1": "value1", "param2": "value2" }; e.headers = { "Custom Header": "value" }; } }); }; }Vue
<script> import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ url: 'https://js.devexpress.com/Demos/DevAV/odata/Products', beforeSend: (e) => { e.params = { 'param1': 'value1', 'param2': 'value2' }; e.headers = { 'Custom Header': 'value' }; } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ url: 'https://js.devexpress.com/Demos/DevAV/odata/Products', beforeSend: (e) => { e.params = { 'param1': 'value1', 'param2': 'value2' }; e.headers = { 'Custom Header': 'value' }; } }); class App extends React.Component { // ... } export default App;
Specifies whether the store serializes/parses date-time values.
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.
Specifies a function that is executed when the ODataStore throws an error.
Function parameters:A JavaScript Error object extended with the following fields:
Object structure:
Name Type Description errorDetailsError details. It is an OData error response object for OData-specific errors or a jqXHR object for other errors when you use jQuery.
httpStatusThe error code.
requestOptionsRequest details. Contains the following fields:
accepts: Object
The data types that the client accepts mapped to their MIME types.
async: Boolean
Indicates whether the request was asynchronous or synchronous.
contentType: String | Boolean
The content type; false if no content type was specified.
data: Object
Query options.
dataType: String
The expected data type.
headers: Object
The request headers.
jsonp: Boolean
Indicates whether the request was sent using JSONP.
method: String
The request method ("GET", "POST", "PATCH", or "MERGE").
timeout: Number
The request timeout.
url: String
The request URL.
xhrFields: Object
Native XMLHttpRequest object properties that were sent in the request.
var store = new DevExpress.data.ODataStore({ // ... errorHandler: function(error) { console.log(error.message); } });Angular
import ODataStore from "devextreme/data/odata/store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ errorHandler: (error) => { console.log(error.message); } }); }; }Vue
<script> import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ // ... errorHandler: (error) => { console.log(error.message); } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ // ... errorHandler: (error) => { console.log(error.message); } }); class App extends React.Component { // ... } export default App;
Specifies the data field types. Accepts the following types: "String", "Int32", "Int64", "Boolean", "Single", "Decimal" and "Guid".
Type: any
Default Value: {}
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.
jQueryvar store = new DevExpress.data.ODataStore({ url: "https://js.devexpress.com/Demos/DevAV/odata/Products", key: "Product_ID", fieldTypes: { Product_ID: "Guid", Product_Name: "String", Product_Price: "Int32" } });Angular
import ODataStore from "devextreme/data/odata/store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ url: "https://js.devexpress.com/Demos/DevAV/odata/Products", key: "Product_ID", fieldTypes: { Product_ID: "Guid", Product_Name: "String", Product_Price: "Int32" } }); }; }Vue
<script> import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ url: 'https://js.devexpress.com/Demos/DevAV/odata/Products', key: 'Product_ID', fieldTypes: { Product_ID: 'Guid', Product_Name: 'String', Product_Price: 'Int32' } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ url: 'https://js.devexpress.com/Demos/DevAV/odata/Products', key: 'Product_ID', fieldTypes: { Product_ID: 'Guid', Product_Name: 'String', Product_Price: 'Int32' } }); class App extends React.Component { // ... } export default App;ASP.NET MVC Controls
@(Html.DevExtreme().WidgetName() .DataSource(d => d.OData() .Url("https://js.devexpress.com/Demos/DevAV/odata/Products") .Key("Product_ID") .FieldTypes(new Dictionary<string, EdmType> { { "Product_ID", EdmType.Guid }, { "Product_Name", EdmType.String }, { "Product_Price", EdmType.Int32 } }) ) )
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')Angular
import ODataStore from 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; // ... export class AppComponent { ds: DataSource; constructor() { this.ds = new DataSource({ store: new 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') } }Vue
<script> import ODataStore from 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; const ds = new DataSource({ store: new 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') export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; const ds = new DataSource{ store: new 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') class App extends React.Component { // ... } export default App;
Specifies whether data should be sent using JSONP.
Specifies the key property (or properties) that provide(s) key values to access data items. Each key value must be unique.
In the following example, the ProductID
and ProductCode
properties are specified as key properties:
var store = new DevExpress.data.ODataStore({ // ... key: ["ProductID", "ProductCode"] });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ // ... key: ["ProductID", "ProductCode"] }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... key: ['ProductID', 'ProductCode'] }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... key: ['ProductID', 'ProductCode'] }); class App extends React.Component { // ... } export default App;
Specifies the type of the key property or properties.
Accepted Values: 'String' | 'Int32' | 'Int64' | 'Guid' | 'Boolean' | 'Single' | 'Decimal'
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" } });Angular
import ODataStore from "devextreme/data/odata/store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ url: "https://js.devexpress.com/Demos/DevAV/odata/Products", key: [ "Product_ID", "Product_Code" ], keyType: { Product_ID: "Guid", Product_Code: "Int32" } }); }; }Vue
<script> import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ url: 'https://js.devexpress.com/Demos/DevAV/odata/Products', key: [ 'Product_ID', 'Product_Code' ], keyType: { Product_ID: 'Guid', Product_Code: 'Int32' } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ url: 'https://js.devexpress.com/Demos/DevAV/odata/Products', key: [ 'Product_ID', 'Product_Code' ], keyType: { Product_ID: 'Guid', Product_Code: 'Int32' } }); class App extends React.Component { // ... } export default App;
A function that is executed after a data item is added to the store.
Function parameters:The added data item.
The item's key.
jQueryvar store = new DevExpress.data.ODataStore({ onInserted: function (values, key) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onInserted: function (values, key) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onInserted: function (values, key) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onInserted: function (values, key) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed before a data item is added to the store.
Function parameters:The data item to be added.
jQueryvar store = new DevExpress.data.ODataStore({ onInserting: function (values) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onInserting: function (values) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onInserting: function (values, key) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onInserting: function (values, key) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed after data is loaded to the store.
Function parameters:The loaded data.
Data processing settings.
jQueryvar store = new DevExpress.data.ODataStore({ onLoaded: function (result) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onLoaded: function (result) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onLoaded: function (result) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onLoaded: function (result) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed before data is loaded to the store.
Function parameters:Data processing settings.
jQueryvar store = new DevExpress.data.ODataStore({ onLoading: function (loadOptions) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onLoading: function (loadOptions) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onLoading: function (loadOptions) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onLoading: function (loadOptions) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed after a data item is added, updated, or removed from the store.
jQueryvar store = new DevExpress.data.ODataStore({ onModified: function () { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onModified: function () { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onModified: function () { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onModified: function () { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed before a data item is added, updated, or removed from the store.
jQueryvar store = new DevExpress.data.ODataStore({ onModifying: function () { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onModifying: function () { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onModifying: function () { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onModifying: function () { // Your code goes here } }); class App extends React.Component { // ... } export default App;
The function executed before changes are pushed to the store.
jQueryvar store = new DevExpress.data.ODataStore({ onPush: function(changes) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onPush: (changes) => { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onPush: (changes) => { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onPush: (changes) => { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed after a data item is removed from the store.
Function parameters:The removed data item's key.
jQueryvar store = new DevExpress.data.ODataStore({ onRemoved: function (key) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onRemoved: function (key) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onRemoved: function (key) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onRemoved: function (key) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed before a data item is removed from the store.
Function parameters:The key of the data item to be removed.
jQueryvar store = new DevExpress.data.ODataStore({ onRemoving: function (key) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onRemoving: function (key) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onRemoving: function (key) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onRemoving: function (key) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed after a data item is updated in the store.
Function parameters:The updated data item's key.
Updated values.
jQueryvar store = new DevExpress.data.ODataStore({ onUpdated: function (key, values) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onUpdated: function (key, values) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onUpdated: function (key, values) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onUpdated: function (key, values) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
A function that is executed before a data item is updated in the store.
Function parameters:The key of the data item to be updated.
New values for the data item fields.
jQueryvar store = new DevExpress.data.ODataStore({ onUpdating: function (key, values) { // Your code goes here } });Angular
import ODataStore from "devextreme/data/odata_store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ onUpdating: function (key, values) { // Your code goes here } }) } }Vue
<script> import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onUpdating: function (key, values) { // Your code goes here } }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata_store'; const store = new ODataStore({ // ... onUpdating: function (key, values) { // Your code goes here } }); class App extends React.Component { // ... } export default App;
Specifies the URL of an OData entity collection.
jQueryvar store = new DevExpress.data.ODataStore({ // ... url: "https://js.devexpress.com/Demos/DevAV/odata/Products" });Angular
import ODataStore from "devextreme/data/odata/store"; // ... export class AppComponent { store: ODataStore; constructor() { this.store = new ODataStore({ // ... url: "https://js.devexpress.com/Demos/DevAV/odata/Products" }); }; }Vue
<script> import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ // ... url: 'https://js.devexpress.com/Demos/DevAV/odata/Products' }); export default { // ... data() { return { store } } } </script>React
// ... import ODataStore from 'devextreme/data/odata/store'; const store = new ODataStore({ // ... url: 'https://js.devexpress.com/Demos/DevAV/odata/Products' }); class App extends React.Component { // ... } export default App;
Specifies the OData version.
Default Value: 4
Accepted Values: 2 | 3 | 4
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.
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.
Feel free to share topic-related thoughts here.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4