-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
-
Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
- Overview
-
Action Sheet
-
Button
- Floating Action Button
- Drop Down Button
-
Context Menu
-
List
-
Lookup
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
JavaScript/jQuery Menu - Overview
Populate JavaScript Menu with Data and Configure the Access to It
You can display JavaScript Menu items from the items array or a dataSource. This demo contains an example of a data structure. If you use a dataSource, specify the displayExpr property.
To access the clicked item, use the onItemClick event handler function.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
$(() => {
const dxMenu = $('#menu').dxMenu({
dataSource: menuData,
hideSubmenuOnMouseLeave: false,
displayExpr: 'name',
onItemClick(data) {
const item = data.itemData;
if (item.price) {
$('#product-details').removeClass('hidden');
$('#product-details > img').attr('src', item.icon);
$('#product-details > .price').text(`$${item.price}`);
$('#product-details > .name').text(item.name);
}
},
}).dxMenu('instance');
const showSubmenuModes = [{
name: 'onHover',
delay: { show: 0, hide: 500 },
}, {
name: 'onClick',
delay: { show: 0, hide: 300 },
}];
$('#show-submenu-mode').dxSelectBox({
items: showSubmenuModes,
value: showSubmenuModes[1],
inputAttr: { 'aria-label': 'Submenu Mode' },
displayExpr: 'name',
onValueChanged(data) {
dxMenu.option('showFirstSubmenuMode', data.value);
},
});
$('#orientation').dxSelectBox({
items: ['horizontal', 'vertical'],
inputAttr: { 'aria-label': 'Orientation' },
value: 'horizontal',
onValueChanged(data) {
dxMenu.option('orientation', data.value);
},
});
$('#mouse-leave').dxCheckBox({
value: false,
text: 'Hide Submenu on Mouse Leave',
onValueChanged(data) {
dxMenu.option('hideSubmenuOnMouseLeave', data.value);
},
});
});
xxxxxxxxxx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>↔</head>
<body class="dx-viewport">
<div class="demo-container">
<div class="form">
<div>
<div class="label">Catalog:</div>
<div id="menu"></div>
<div id="product-details" class="hidden">
<img src="" />
<div class="name"></div>
<div class="price"></div>
</div>
</div>
<div class="options">
<div class="caption">Options</div>
<div class="option">
<div>Show First Submenu Mode</div>
<div id="show-submenu-mode"></div>
</div>
<div class="option">
<div>Orientation</div>
<div id="orientation"></div>
</div>
<div class="option">
<div id="mouse-leave"></div>
</div>
</div>
</div>
</div>
</body>
</html>
xxxxxxxxxx
.form {
margin-left: 3px;
}
.form > div:first-child {
margin-right: 320px;
}
.label {
font-size: 22px;
padding-bottom: 24px;
}
#product-details {
width: 400px;
height: 400px;
margin: 20px auto 0;
}
#product-details > img {
height: 300px;
width: 400px;
}
#product-details > .name {
text-align: center;
font-size: 20px;
}
#product-details > .price {
text-align: center;
font-size: 24px;
}
.dark #product-details > div {
color: #f0f0f0;
}
.options {
padding: 20px;
position: absolute;
bottom: 0;
right: 0;
width: 260px;
top: 0;
background-color: rgba(191, 191, 191, 0.15);
}
.caption {
font-size: 18px;
font-weight: 500;
}
.option {
margin-top: 10px;
}
.hidden {
visibility: hidden;
}
xxxxxxxxxx
const menuData = [{
id: '1',
name: 'Video Players',
items: [{
id: '1_1',
name: 'HD Video Player',
price: 220,
icon: 'images/products/1.png',
}, {
id: '1_2',
name: 'SuperHD Video Player',
icon: 'images/products/2.png',
price: 270,
}],
}, {
id: '2',
name: 'Televisions',
items: [{
id: '2_1',
name: 'SuperLCD 42',
icon: 'images/products/7.png',
price: 1200,
}, {
id: '2_2',
name: 'SuperLED 42',
icon: 'images/products/5.png',
price: 1450,
}, {
id: '2_3',
name: 'SuperLED 50',
icon: 'images/products/4.png',
price: 1600,
}, {
id: '2_4',
name: 'SuperLCD 55 (Not available)',
icon: 'images/products/6.png',
price: 1350,
disabled: true,
}, {
id: '2_5',
name: 'SuperLCD 70',
icon: 'images/products/9.png',
price: 4000,
}],
}, {
id: '3',
name: 'Monitors',
items: [{
id: '3_1',
name: '19"',
items: [{
id: '3_1_1',
name: 'DesktopLCD 19',
icon: 'images/products/10.png',
price: 160,
}],
}, {
id: '3_2',
name: '21"',
items: [{
id: '3_2_1',
name: 'DesktopLCD 21',
icon: 'images/products/12.png',
price: 170,
}, {
id: '3_2_2',
name: 'DesktopLED 21',
icon: 'images/products/13.png',
price: 175,
}],
}],
}, {
id: '4',
name: 'Projectors',
items: [{
id: '4_1',
name: 'Projector Plus',
icon: 'images/products/14.png',
price: 550,
}, {
id: '4_2',
name: 'Projector PlusHD',
icon: 'images/products/15.png',
price: 750,
}],
}];
Configure the JavaScript Menu
Use the orientation property to specify whether the JavaScript Menu has horizontal or vertical orientation. Use the animation property to specify the type, delay, duration, and other options of show and hide menu actions.
Configure the Submenus
Clicking or a hovering a JavaScript Menu item opens a drop-down menu that can contain several submenus. To specify the drop-down menu mode ("onClick" or "onHover"), use the showSubmenuMode property. If you need only to specify the first level of drop-down menus, use the showFirstSubmenuMode property.
If you want to hide the submenu when the mouse pointer leaves it, set the hideSubmenuOnMouseLeave property to true.
Customize Item Appearance
You can define specific fields in the item data objects to change the appearance of an item. For example, use the icon property to supply items with icons. Define an itemTemplate to customize item appearance.