A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://js.devexpress.com/jQuery/Documentation/ApiReference/Data_Layer/ArrayStore/ below:

DevExtreme jQuery - ArrayStore API

jQuery
var states = [
    { id: 1, state: "Alabama", capital: "Montgomery" },
    { id: 2, state: "Alaska", capital: "Juneau" },
    { id: 3, state: "Arizona", capital: "Phoenix" },
    // ...
];

var store = new DevExpress.data.ArrayStore({
    key: "id",
    data: states,
    // Other ArrayStore properties go here
});

// ===== or inside the DataSource =====
var dataSource = new DevExpress.data.DataSource({
    store: {
        type: "array",
        key: "id",
        data: states,
        // Other ArrayStore properties go here
    },
    // Other DataSource properties go here
});
Angular
import ArrayStore from "devextreme/data/array_store";
import DataSource from "devextreme/data/data_source";
// ...
export class AppComponent {
    store: ArrayStore;
    dataSource: DataSource;
    states = [
        { id: 1, state: "Alabama", capital: "Montgomery" },
        { id: 2, state: "Alaska", capital: "Juneau" },
        { id: 3, state: "Arizona", capital: "Phoenix" },
        // ...
    ];
    constructor () {
        this.store = new ArrayStore({
            key: "id",
            data: this.states,
            // Other ArrayStore properties go here
        });

        // ===== or inside the DataSource =====
        this.dataSource = new DataSource({
            store: new ArrayStore({
                key: "id",
                data: this.states,
                // Other ArrayStore properties go here
            }),
            // Other DataSource properties go here
        });
    }
}
Vue
<script>
import ArrayStore from 'devextreme/data/array_store';
import DataSource from 'devextreme/data/data_source';

const states = [
    { id: 1, state: 'Alabama', capital: 'Montgomery' },
    { id: 2, state: 'Alaska', capital: 'Juneau' },
    { id: 3, state: 'Arizona', capital: 'Phoenix' },
    // ...
];

const store = new ArrayStore({
    key: 'id',
    data: states,
    // Other ArrayStore properties go here
});

// ===== or inside the DataSource =====
const dataSource = new DataSource({
    store: new ArrayStore({
        key: 'id',
        data: states,
        // Other ArrayStore properties go here
    }),
    // Other DataSource properties go here
});

export default {
    // ...
    data() {
        return {
            store,
            // ===== or =====
            dataSource
        }
    }
}
</script>
React
// ...
import ArrayStore from 'devextreme/data/array_store';
import DataSource from 'devextreme/data/data_source';

const states = [
    { id: 1, state: 'Alabama', capital: 'Montgomery' },
    { id: 2, state: 'Alaska', capital: 'Juneau' },
    { id: 3, state: 'Arizona', capital: 'Phoenix' },
    // ...
];

const store = new ArrayStore({
    key: 'id',
    data: states,
    // Other ArrayStore properties go here
});

// ===== or inside the DataSource =====
const dataSource = new DataSource({
    store: new ArrayStore({
        key: 'id',
        data: states,
        // Other ArrayStore properties go here
    }),
    // Other DataSource properties go here
});

class App extends React.Component {
    // ...
}
export default App;
ASP.NET MVC Controls
@(Html.DevExtreme().WidgetName()
    .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" },
            // ...
        })
    )
)
@* ===== or a simplified version ===== *@
@(Html.DevExtreme().WidgetName()
    .DataSource(new[] {
        new { id = 1, state = "Alabama", capital = "Montgomery" },
        new { id = 2, state = "Alaska", capital = "Juneau" },
        new { id = 3, state = "Arizona", capital = "Phoenix" },
        // ...
    }, "id")
)
@(Html.DevExtreme().WidgetName() _
    .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)
)
@* ===== or a simplified version ===== *@
@(Html.DevExtreme().WidgetName() _
    .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")
)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4