ArrayStore

A Store accessing an in-memory array.

Included in: dx.mobile.js, dx.web.js, dx.viz.js, dx.viz-web.js, dx.all.js
Export: default
Type:

Object

To associate an array with the ArrayStore, pass this array to the ArrayStore constructor.

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

If you need to specify configuration options of the ArrayStore other than data, pass an object to the ArrayStore constructor.

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

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

See Also

When configuring a widget using ASP.NET MVC Wrappers, declare the ArrayStore using the syntax shown in the following example. This example configures the SelectBox widget.

Razor C#
Razor VB
@(Html.DevExtreme().SelectBox()
    .ID("selectBox")
    .DataSource(ds => ds.Array()
        .Key("id")
        .Data(new [] {
            new { id = 1, state = "Alabama", capital = "Montgomery" },
            new { id = 2, state = "Alaska", capital = "Juneau" },
            new { id = 3, state = "Arizona", capital = "Phoenix" },
            // ...
        })
    )
    .DisplayExpr("state")
    .ValueExpr("id")
)
@* ===== or a simplified version ===== *@
@(Html.DevExtreme().SelectBox()
    .ID("selectBox")
    .DataSource(new[] {
        new { id = 1, state = "Alabama", capital = "Montgomery" },
        new { id = 2, state = "Alaska", capital = "Juneau" },
        new { id = 3, state = "Arizona", capital = "Phoenix" },
        // ...
    }, "id")
    .DisplayExpr("state")
    .ValueExpr("id")
)
@(Html.DevExtreme().SelectBox() _
    .ID("selectBox") _
    .DataSource(Function(ds)
        Return ds.Array() _
                 .Key("id") _
                 .Data({
                     New With { .id = 1, .state = "Alabama", .capital = "Montgomery" },
                     New With { .id = 2, .state = "Alaska", .capital = "Juneau" },
                     New With { .id = 3, .state = "Arizona", .capital = "Phoenix" }
                 })
    End Function) _
    .DisplayExpr("state") _
    .ValueExpr("id")
)
@* ===== or a simplified version ===== *@
@(Html.DevExtreme().SelectBox() _
    .ID("selectBox") _
    .DataSource({
        New With { .id = 1, .state = "Alabama", .capital = "Montgomery" },
        New With { .id = 2, .state = "Alaska", .capital = "Juneau" },
        New With { .id = 3, .state = "Arizona", .capital = "Phoenix" }
    }, "id") _
    .DisplayExpr("state") _
    .ValueExpr("id")
)

Configuration

This section describes configuration options used to configure the ArrayStore.

Methods

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

Events

This section describes events raised by this Data Store object.

To handle events, use one of the following methods.