ODataStore

A Store providing access to a separate OData web service entity.

Included in: dx.phonejs.js, dx.webappjs.js, dx.chartjs.js, dx.all.js
Type:

Object

To access the entire OData service, use the ODataContext object.

If you need to create a separate ODataStore instance, call the ODataStore constructor and specify the URL of the required entity via the url configuration option.

JavaScript
var store = new DevExpress.data.ODataStore({
    url: "/url/to/service",
    key: "CategoryID",
    keyType: "Int32"
});

Note that the key and keyType configuration options provide read-write access to the entity.

For more information on working with OData web services, refer to the Data Source Examples article.

Configuration

This section describes the configuration options used to configure the ODataStore.

Name Description
beforeSend

A function used to customize a web request before it is sent.

deserializeDates

Specifies whether or not dates found in the response are deserialized.

errorHandler

Specifies the function called when the Store causes an error.

jsonp

Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services.

key

Specifies the key properties within the data associated with the Store.

keyType

Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid.

onInserted

A handler for the inserted event.

onInserting

A handler for the *inserting event.

onLoaded

A handler for the *loaded event.

onLoading

A handler for the *loading event.

onModified

A handler for the *modified event.

onModifying

A handler for the modifying event.

onRemoved

A handler for the *removed event.

onRemoving

A handler for the *removing event.

onUpdated

A handler for the *updated event.

onUpdating

A handler for the *updating event.

url

Specifies the URL of the entity being accessed via the current ODataStore.

version

Specifies the version of the OData protocol used to interact with the data service.

withCredentials

Specifies the value of the withCredentials field of the underlying jqXHR object.

Methods

This section describes the methods used to access the data associated with the ODataStore.

Name Description
byKey(key)

Returns the data item specified by the key.

byKey(key, extraOptions)

Returns the data item specified by the key.

createQuery(loadOptions)

Creates the Query object for the OData endpoint.

insert(values)

Adds an item to the data associated with this Store.

key()

Returns the key expression specified via the key configuration option.

keyOf(obj)

Returns the key of the Store item that matches the specified object.

load(options)

Starts loading data.

off(eventName)

Detaches all event handlers from the specified event.

off(eventName, eventHandler)

Detaches a particular event handler from the specified event.

on(eventName, eventHandler)

Subscribes to a specified event.

on(events)

Subscribes to the specified events.

remove(key)

Removes the data item specified by the key.

totalCount(options)

Obtains the total count of items that will be returned by the load() function.

update(key, values)

Updates the data item specified by the key.

Events

This section describes events raised by this ODataStore instance.

Name Description
inserted

Fires after a data item is added.

inserting

Fires before a data item is added.

loaded

Fires after data is loaded.

loading

Fires before data is loaded.

modified

Fires after data is modified.

modifying

Fires before the data is modified.

removed

Fires after a data item has been removed.

removing

Fires before a data item is removed.

updated

Fires after a data item has been updated.

updating

Fires before a data item is updated.

To handle events, use one of the following methods.