React DataGrid - toolbar

Configures the toolbar.

Type:

dxDataGridToolbar

| undefined
Default Value: undefined

disabled

Specifies whether the toolbar responds to user interaction.

Type:

Boolean

Default Value: false

items[]

Configures toolbar items.

The toolbar can contain the following elements as items:

  • Predefined controls
    Predefined controls appear on the toolbar depending on whether a specific DataGrid feature is enabled. The following table illustrates the dependency:

    Control NameImagePrerequisites
    aiAssistantButtonDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar AI Assistant ButtonaiIntegration or aiAssistant.aiIntegration is configured and aiAssistant.enabled is true
    addRowButtonDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar AddButtonediting.allowAdding is true
    applyFilterButtonDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar ApplyFilterButtonfilterRow.visible is true and filterRow.applyFilter is set to "onClick"
    columnChooserButtonDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar ColumnChooserButtoncolumnChooser.enabled is true
    revertButtonDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar RevertButtonediting.mode is set to "batch"
    saveButtonDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar SaveButtonediting.mode is set to "batch" and editing.allowUpdating is true
    searchPanelDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar searchPanelsearchPanel.visible is true
    exportButtonDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar ExportButtonThe export feature is configured.
    groupPanelDevExtreme JavaScript jQuery Angular UI component DataGrid Toolbar GroupPanelgroupPanel.visible is set to true or "auto"

    If you need to customize a predefined control, add an object to the items[] array. This object must contain the control's name and properties that you want to customize. If a control does not need customization, simply include its name in the toolbar.items[] array.

    The example below customizes the Column Chooser button, adds an Add Row button, and enables the corresponding DataGrid features:

    App.js
    • import DataGrid, { Editing, Toolbar, Item, ColumnChooser } from 'devextreme-react/data-grid';
    • // ...
    • function App() {
    • return (
    • <DataGrid ... >
    • <Editing allowAdding={true} />
    • <ColumnChooser enabled={true} />
    • <Toolbar>
    • <Item name="addRowButton" />
    • <Item
    • name="columnChooserButton"
    • locateInMenu="auto"
    • location="after"
    • />
    • </Toolbar>
    • </DataGrid>
    • );
    • }
    IMPORTANT
    The DataGrid does not display controls missing from the items[] array. Ensure that this array includes controls for all enabled features.
  • DevExtreme components

    You can use DevExtreme components as toolbar items. Declare an Item element to add a supported component:

    App.js
    • import { SelectBox } from 'devextreme-react/select-box';
    • import DataGrid, { Toolbar, Item } from 'devextreme-react/data-grid';
    • // ...
    • function App() {
    • return (
    • <DataGrid ... >
    • <Toolbar>
    • <Item>
    • <SelectBox>
    • {/* SelectBox properties are specified here */}
    • </SelectBox>
    • </Item>
    • </Toolbar>
    • </DataGrid>
    • );
    • }
  • Custom controls
    To use a custom control, specify a template for it.

View Demo

visible

Specifies whether the toolbar is visible.

Type:

Boolean

| undefined
Default Value: undefined

This property can have one of the following values:

toolbar.visibleDescription
trueThe toolbar is always visible.
falseThe toolbar is always hidden.
undefinedThe toolbar is visible only if there are items to display.