DevExtreme v24.2 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

JavaScript/jQuery Toolbar - Overview

The JavaScript Toolbar contains items that manage the page content. In this demo, the JavaScript Toolbar manages the List.

DevExtreme Accessibility Compliance
DevExtreme component libraries meet a variety of WCAG and Section 508 compliance standards. To assess this demo’s accessibility level, click the Run AXE® Validation button to launch the AXE® web accessibility evaluation tool.
All trademarks or registered trademarks are property of their respective owners. AXE® Terms of Use
The overall accessibility level of your application depends on the Toolbar features used.
Backend API
$(() => { $('#toolbar').dxToolbar({ items: [{ location: 'before', widget: 'dxButton', options: { icon: 'back', onClick() { DevExpress.ui.notify('Back button has been clicked!'); }, }, }, { location: 'before', widget: 'dxButton', locateInMenu: 'auto', options: { icon: 'refresh', onClick() { DevExpress.ui.notify('Refresh button has been clicked!'); }, }, }, { location: 'center', locateInMenu: 'never', template() { return $("<div class='toolbar-label'><b>Tom's Club</b> Products</div>"); }, }, { location: 'after', widget: 'dxSelectBox', locateInMenu: 'auto', options: { width: 140, items: productTypes, valueExpr: 'id', displayExpr: 'text', value: productTypes[0].id, inputAttr: { 'aria-label': 'Categories' }, onValueChanged(args) { if (args.value > 1) { productsStore.filter('type', '=', args.value); } else { productsStore.filter(null); } productsStore.load(); }, }, }, { location: 'after', widget: 'dxButton', locateInMenu: 'auto', options: { icon: 'plus', onClick() { DevExpress.ui.notify('Add button has been clicked!'); }, }, }, { locateInMenu: 'always', widget: 'dxButton', options: { text: 'Save', onClick() { DevExpress.ui.notify('Save option has been clicked!'); }, }, }, { locateInMenu: 'always', widget: 'dxButton', options: { text: 'Print', onClick() { DevExpress.ui.notify('Print option has been clicked!'); }, }, }, { locateInMenu: 'always', widget: 'dxButton', options: { text: 'Settings', onClick() { DevExpress.ui.notify('Settings option has been clicked!'); }, }, }, ], }); const productsStore = new DevExpress.data.DataSource(products); $('#products').dxList({ dataSource: productsStore, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/24.2.3/css/dx.light.css" /> <script src="js/dx.all.js"></script> <script src="data.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="toolbar"></div> <div id="products"></div> </div> </body> </html>
.toolbar-label, .toolbar-label > b { font-size: 16px; } #products { margin-top: 10px; }
const productTypes = [{ id: 1, text: 'All', }, { id: 2, text: 'Video Players', }, { id: 3, text: 'Televisions', }, { id: 4, text: 'Monitors', }, { id: 5, text: 'Projectors', }]; const products = [{ text: 'HD Video Player', type: 2, }, { text: 'SuperHD Video Player', type: 2, }, { text: 'SuperLCD 42', type: 3, }, { text: 'SuperLED 42', type: 3, }, { text: 'SuperLED 50', type: 3, }, { text: 'SuperLCD 55', type: 3, }, { text: 'DesktopLCD 19', type: 4, }, { text: 'DesktopLCD 21', type: 4, }, { text: 'DesktopLED 21', type: 4, }, { text: 'Projector Plus', type: 5, }, { text: 'Projector PlusHD', type: 5, }];

Configure JavaScript Toolbar Items

You can display JavaScript Toolbar items from an items array or a dataSource. A JavaScript Toolbar item may be plain text or a UI component. You should specify the text or the widget property depending on the item. If the item is a UI component, declare its options.

Specify Item Location

You can set the dataSource with location fields or specify the location property for each item. The location value can be one of the following:

  • "center"
    Places the item in the center of the toolbar.

  • "before"
    Places the item before the central element(s).

  • "after"
    Places the item after the central element(s).

Additionally, the JavaScript Toolbar can render its items in the overflow menu. Specify the locateInMenu property for each item with one of the following values:

  • "always"
    Always places the item in the overflow menu.

  • "never"
    Places the item outside of the overflow menu.

  • "auto"
    Places the item outside of the overflow menu. If all items cannot fit within the width of the JavaScript Toolbar, it renders this item in the overflow menu.

Note that you cannot specify the order of the items with locateinMenu="auto" placed in the overflow menu.

Customize Item Appearance

You can define the itemTemplate to customize item appearance. To customize the items in the overflow menu, use the menuItemTemplate.