All docs
V19.1
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
17.2
A newer version of this page is available. Switch to the current version.

DevExtreme jQuery - ArrayStore

If you want to extend the functionality of a JavaScript array, place it into an ArrayStore. It provides an interface for loading and editing data, and allows you to handle data-related events.

jQuery
JavaScript
$(function() {
    $("#listContainer").dxList({
        dataSource: new DevExpress.data.ArrayStore({
            data: fruits,
            onLoaded: function() {
                // Event handling commands go here
            }
        }),
        itemTemplate: function(data, _, element) {
            element.append(
                $("<b>").text(data.fruit), $("<br />"),
                $("<p>").text(data.count).css("margin", 0)
            )
        }
    });
});
Angular
TypeScript
HTML
import { DxListModule } from "devextreme-angular";
import ArrayStore from "devextreme/data/array_store";
// ...
export class AppComponent {
    fruits = [ /* ... */ ];
    fruitStore = new ArrayStore({
        data: this.fruits,
        onLoaded: function () {
            // Event handling commands go here
        }
    });
}
@NgModule({
    imports: [
        // ...
        DxListModule
    ],
    // ...
})
<dx-list
    [dataSource]="fruitStore">
    <div *dxTemplate="let data of 'item'">
        <b>{{data.fruit}}</b><br/>
        <p style="margin:0">{{data.count}}</p>
    </div>
</dx-list>

Data kept in an ArrayStore can be processed in the DataSource. Its purpose is similar to that of the Query, but DataSource provides wider capabilities. For example, the DataSource can map objects from the array that underlies the ArrayStore, as shown in the following code where the resulting objects match the default item template.

jQuery
JavaScript
var fruits = [
    { fruit: "Apples", count: 10 },
    // ...
];

$(function() {
    $("#listContainer").dxList({
        dataSource: new DevExpress.data.DataSource({
            store: fruits,
            map: function(item) {
                return {
                    text: item.fruit,
                    badge: item.count
                }   
            }
        })
    });
});
Angular
TypeScript
HTML
import { DxListModule } from "devextreme-angular";
import DataSource from "devextreme/data/data_source";
// ...
export class AppComponent {
    fruits = [
        { fruit: "Apples", count: 10 },
        // ...
    ];
    fruitDataSource = new DataSource({
        store: this.fruits,
        map: function (item) {
            return {
                text: item.fruit,
                badge: item.count
            }   
        }
    });
}
@NgModule({
    imports: [
        // ...
        DxListModule
    ],
    // ...
})
<dx-list
    [dataSource]="fruitDataSource">
</dx-list>
NOTE
Even if you have passed a JavaScript array to the dataSource option, the List automatically places it into an ArrayStore wrapped into the DataSource that you can get with the getDataSource() method.
See Also