DevExtreme Angular - ArrayStore

Extend a JavaScript array's functionality by placing it into an ArrayStore. It provides an interface for loading and editing data, and allows you to handle data-related events.

JavaScript
  • $(function() {
  • $("#selectBoxContainer").dxSelectBox({
  • dataSource: new DevExpress.data.ArrayStore({
  • data: products,
  • onLoaded: function() {
  • // Event handling commands go here
  • }
  • }),
  • valueExpr: 'price',
  • displayExpr: 'name'
  • });
  • });

Data kept in the ArrayStore can be processed in a DataSource. For example, the DataSource can sort data.

JavaScript
  • var products = [
  • { name: "HD Video Player", price: 100 },
  • { name: "SuperHD Video Player", price: 420 },
  • { name: "SuperPlasma 50", price: 1500 },
  • { name: "SuperLED 50", price: 200 }
  • ];
  •  
  • $(function() {
  • $("#selectBoxContainer").dxSelectBox({
  • dataSource: new DevExpress.data.DataSource({
  • store: products,
  • sort: { getter: "name", asc: true }
  • }),
  • valueExpr: 'price',
  • displayExpr: 'name'
  • });
  • });
NOTE
Even if you have passed a JavaScript array to the dataSource option, the SelectBox automatically places it into an ArrayStore wrapped into the DataSource you can get with the getDataSource() method.
See Also