ArrayStore

A Store accessing an in-memory array.

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

Object

To associate the required array with the ArrayStore, pass this array ArrayStore constructor.

JavaScript
var store = new DevExpress.data.ArrayStore(array);

If you need to specify other configuration option of the ArrayStore in addition to the data array, pass the required array to the data configuration option.

JavaScript
var store = new DevExpress.data.ArrayStore({
    data: array,
    key: "id",
    modified: function() {
        // 'modified' event handler
    },
    errorHandler: function(error) {
        // Error handler
    }
});

Note, that the key option is required if you are going to use the Store for read-write access to data.

For more information on working with in-memory data, refer to the Data Source Examples article.

Configuration

This section describes configuration options used to configure the ArrayStore.

Name Description
data

Specifies the array associated with this Store.

errorHandler

Specifies the function called when the Store causes an error.

key

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

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.

Methods

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

Name Description
byKey(key)

Returns the data item specified by the key.

clear()

Clears all data associated with the current ArrayStore.

createQuery()

Creates the Query object for the underlying array.

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 Data Store object.

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.