-
Data Grids / Data Management
-
Data Grid
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Grouping
-
Selection
- Focused Row
- Paging
-
Scrolling
-
Columns
-
Master-Detail
-
Data Summaries
-
Drag & Drop
-
Export to PDF
-
Export to Excel
- Appearance
-
Customization
- State Persistence
-
Adaptability
-
Keyboard Navigation
- Right-To-Left Support
-
Tree List
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Selection
- Focused Row
- Paging
-
Columns
- Drag & Drop
- State Persistence
- Adaptability
-
Keyboard Navigation
-
Card View
-
Pivot Grid
- Overview
-
Data Binding
-
Field Management
-
Data Summaries
- Drill Down
- Filtering
-
Scrolling
-
Export to Excel
- Chart Integration
- Customization
- State Persistence
-
Filter Builder
-
-
Data Visualization
-
Charts
- Overview
-
Data Binding
-
Common Concepts
-
Axis
-
Aggregation
-
Tooltips
-
Selection
-
Customization
-
Zooming
-
Export
-
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Funnel and Pyramid Charts
-
Line Charts
- Pareto Chart
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
- Sankey Chart
-
Sparkline Charts
-
Tree Map
-
Gauges
- Overview
-
Runtime update
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
-
Scheduling / Planning
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Appointments
-
Timetable
- Editing
-
Grouping
- Virtual Scrolling
- Drag & Drop
-
Customization
- Adaptability
-
Gantt
- Overview
- Data Binding
-
Filtering
- Sorting
- Strip Lines
- Export to PDF
- Validation
-
Customization
-
-
Reporting
-
AI-powered Extensions
-
Interaction
-
Report Types
-
Data binding
-
Real-life Reports
-
Layout Features
-
Report Controls
-
Web-specific Features
-
-
Rich Text Editor
- Overview
- Load/Save
- Document Protection
-
Templates
- Autocorrect
-
Customization
- Simple View
-
Spreadsheet
- Overview
-
Open a Document
- Export And Printing
-
Features
-
UI Customization
-
Messaging
-
WYSIWYG Editor
-
Forms
-
Data Editors
- Overview
-
Common Concepts
-
Calendar
- Check Box
- Color Box
- Date Box
-
Date Range Box
-
Number Box
- Radio Group
-
Range Selector
- Range Slider
- Slider
- Speech To Text
- Switch
- Text Area
- Text Box
-
Drop-Downs
- Autocomplete
-
Drop Down Box
-
Select Box
-
Tag Box
-
Lookup
-
Buttons
-
File Upload / File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Popup and Notifications
-
Navigation
- Overview
- Accordion
-
Context Menu
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
-
Stepper
- Pagination
-
List
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
-
-
Interactive Wrappers
-
Sortable
- Resizable
-
-
Progress Indicators
-
Maps
- Overview
-
Map
-
Vector Map
-
Data Binding
- Multiple Layers
-
Markers
- Legend
-
Zooming and Panning
-
Customization
-
-
Localization
Menu - Overview
Populate Menu with Data and Configure the Access to It
You can display 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.
<div class="form"> <div> <div class="label">Catalog:</div> @(Html.DevExtreme().Menu() .ID("menu") .DataSource(d => d.Mvc().LoadAction("GetProducts")) .HideSubmenuOnMouseLeave(false) .OnItemClick("menuItem_click") ) <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> @(Html.DevExtreme().SelectBox() .DataSource(new JS("showSubmenuModes")) .InputAttr("aria-label", "Submenu Mode") .Value(new JS("showSubmenuModes[1]")) .DisplayExpr("name") .OnValueChanged("firstSubMenuMode_changed") ) </div> <div class="option"> <div>Orientation</div> @(Html.DevExtreme().SelectBox() .DataSource(new[] { "horizontal", "vertical" }) .InputAttr("aria-label", "Orientation") .Value("horizontal") .OnValueChanged("menuOrientation_changed") ) </div> <div class="option"> @(Html.DevExtreme().CheckBox() .Value(false) .Text("Hide Submenu on Mouse Leave") .OnValueChanged("checkBoxValue_changed") ) </div> </div></div><script> var showSubmenuModes = [{ name: "onHover", delay: { show: 0, hide: 500 } }, { name: "onClick", delay: { show: 0, hide: 300 } }]; function getMenuInstance() { return $("#menu").dxMenu("instance"); } function menuItem_click(data) { var 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.text); } } function firstSubMenuMode_changed(data) { getMenuInstance().option("showFirstSubmenuMode", data.value); } function menuOrientation_changed(data) { getMenuInstance().option("orientation", data.value); } function checkBoxValue_changed(data) { getMenuInstance().option("hideSubmenuOnMouseLeave", data.value); }</script>xxxxxxxxxxusing DevExtreme.AspNet.Data;using DevExtreme.AspNet.Mvc;using DevExtreme.NETCore.Demos.Models.SampleData;using Microsoft.AspNetCore.Mvc;using System.Text.Json;namespace DevExtreme.NETCore.Demos.Controllers { public class MenuController : Controller { public ActionResult Overview() { return View(); } public ActionResult Scrolling() { return View(); } [HttpGet] public object GetProducts(DataSourceLoadOptions loadOptions) { return DataSourceLoader.Load(MenuData.Products, loadOptions); } [HttpGet] public ActionResult GetScrollingProducts(DataSourceLoadOptions loadOptions) { return Content(JsonSerializer.Serialize(DataSourceLoader.Load(MenuScrollingData.Products, loadOptions)), "application/json"); } }}xxxxxxxxxxusing System;using System.Collections.Generic;using System.Linq;namespace DevExtreme.NETCore.Demos.Models.SampleData { public static class MenuData { public static readonly IEnumerable<MenuItem> Products = new[] { new MenuItem { text = "Video Players", items = new[] { new MenuItem { text = "HD Video Player", price = 220, icon = "../../images/ProductsLarge/1.png" }, new MenuItem { text = "SuperHD Video Player", price = 270, icon = "../../images/ProductsLarge/2.png" } } }, new MenuItem { text = "Televisions", items = new[] { new MenuItem { text = "SuperLCD 42", price = 1200, icon = "../../images/ProductsLarge/7.png" }, new MenuItem { text = "SuperLED 42", price = 1450, icon = "../../images/ProductsLarge/5.png" }, new MenuItem { text = "SuperLED 50", price = 1600, icon = "../../images/ProductsLarge/4.png" }, new MenuItem { text = "SuperLCD 55 (Not available)", price = 1350, icon = "../../images/ProductsLarge/6.png", disabled = true }, new MenuItem { text = "SuperLCD 70", price = 4000, icon = "../../images/ProductsLarge/9.png" } } }, new MenuItem { text = "Monitors", items = new[] { new MenuItem { text = "19\"", items = new[] { new MenuItem { text = "DesktopLCD 19", price = 160, icon = "../../images/ProductsLarge/10.png" } } }, new MenuItem { text = "21\"", items = new[] { new MenuItem { text = "DesktopLCD 21", price = 170, icon = "../../images/ProductsLarge/12.png" }, new MenuItem { text = "DesktopLED 21", price = 175, icon = "../../images/ProductsLarge/13.png" } } } } }, new MenuItem { text = "Projectors", items = new[] { new MenuItem { text = "Projector Plus", price = 550, icon = "../../images/ProductsLarge/14.png" }, new MenuItem { text = "Projector PlusHD", price = 750, icon = "../../images/ProductsLarge/15.png" } } } }; }}xxxxxxxxxxusing System;using System.Collections.Generic;using System.Linq;namespace DevExtreme.NETCore.Demos.Models { public class MenuItem { public string text { get; set; } public bool disabled { get; set; } public string icon { get; set; } public int price { get; set; } public IEnumerable<MenuItem> items { get; set; } }}xxxxxxxxxx.form { margin-left: 3px;}.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);}.option { margin-top: 10px;}.caption { font-size: 18px; font-weight: 500;}.hidden { visibility: hidden;}Configure the Menu
Use the orientation property to specify whether the 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 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.