OData Service

Use the ODataStore to bind the TagBox to data an OData service provides.

jQuery
JavaScript
$(function() {
    $("#tagBoxContainer").dxTagBox({
        dataSource: new DevExpress.data.ODataStore({
            url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
            key: "Product_ID"
        }),
        valueExpr: "Product_Cost",
        displayExpr: "Product_Name"
    });
});
Angular
HTML
TypeScript
<dx-tag-box
    [dataSource]="productsStore"
    valueExpr="Product_Cost"
    displayExpr="Product_Name">
</dx-tag-box>
import ODataStore from "devextreme/data/odata/store";
import { DxTagBoxModule } from "devextreme-angular";
// ...
export class AppComponent {
    productsStore: ODataStore = new ODataStore({
        url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
        key: "Product_ID"
    });
}
@NgModule({
     imports: [
         // ...
         DxTagBoxModule
     ],
     // ...
 })
Vue
<template>
    <DxTagBox
        :data-source="dataSource"
        value-expr="Product_Cost"
        display-expr="Product_Name"
    />
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import { DxTagBox } from 'devextreme-vue/tag-box';
import ODataStore from "devextreme/data/odata/store";

export default {
    components: {
        DxTagBox
    },
    data() {
        return {
            dataSource: new ODataStore({
                url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
                key: "Product_ID"
            })
        };
    }
}
</script>
React
import React from 'react';
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import { TagBox } from 'devextreme-react/tag-box';
import ODataStore from "devextreme/data/odata/store";

const dataSource = new ODataStore({
    url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
    key: "Product_ID"
});

class App extends React.Component {
    render() {
        return (
            <TagBox
                dataSource={dataSource}
                valueExpr="Product_Cost"
                displayExpr="Product_Name"
            />
        );
    }
}

export default App;

Data kept in the ODataStore can be processed in a DataSource. For example, the DataSource can filter data.

jQuery
JavaScript
$(function() {
    $("#tagBoxContainer").dxTagBox({
        dataSource: new DevExpress.data.DataSource({
            store: {
                type: "odata",
                url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
                key: "Product_ID"
            },
            filter: ["Product_Available", "=", true]
        }),
        valueExpr: "Product_Cost",
        displayExpr: "Product_Name"
    });
});
Angular
HTML
TypeScript
<dx-tag-box
    [dataSource]="productsStore"
    valueExpr="Product_Cost"
    displayExpr="Product_Name">
</dx-tag-box>
import "devextreme/data/odata/store";
import DataSource from "devextreme/data/data_source";
import { DxTagBoxModule } from "devextreme-angular";
// ...
export class AppComponent {
    productsStore = new DataSource({
        store: {
            type: "odata",
            url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
            key: "Product_ID"
        },
        filter: ["Product_Available", "=", true]
    });
}
@NgModule({
     imports: [
         // ...
         DxTagBoxModule
     ],
     // ...
 })
Vue
<template>
    <DxTagBox
        :data-source="dataSource"
        value-expr="Product_Cost"
        display-expr="Product_Name"
    />
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import { DxTagBox } from 'devextreme-vue/tag-box';
import DataSource from "devextreme/data/data_source";

export default {
    components: {
        DxTagBox
    },
    data() {
        return {
            dataSource: new DataSource({
                store: {
                    type: "odata",
                    url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
                    key: "Product_ID"
                },
                filter: ["Product_Available", "=", true]
            })
        };
    }
}
</script>
React
import React from 'react';
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import { TagBox } from 'devextreme-react/tag-box';
import DataSource from "devextreme/data/data_source";

const dataSource = new DataSource({
    store: {
        type: "odata",
        url: "https://js.devexpress.com/Demos/DevAV/odata/Products",
        key: "Product_ID"
    },
    filter: ["Product_Available", "=", true]
});

class App extends React.Component {
    render() {
        return (
            <TagBox
                dataSource={dataSource}
                valueExpr="Product_Cost"
                displayExpr="Product_Name"
            />
        );
    }
}

export default App;
See Also