-
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
Accordion
The Accordion component contains several panels displayed one under another. Users can expand or collapse these panels, which makes this component useful to present information in a limited amount of space.
<div id="accordion"> @(Html.DevExtreme().Accordion() .ID("accordion-container") .DataSource(d => d.Mvc().LoadAction("GetData").Key("ID")) .AnimationDuration(300) .Collapsible(false) .Multiple(false) .OnSelectionChanged("accordion_selectionChanged") .ItemTitleTemplate(@<text><div class="header"><%- Name %></div></text>) .ItemTemplate(@<text> <div class="accodion-item"> <div> <p> <b><%- City %></b> (<span><%- State %></span>) </p> <p> <span><%- ZipCode %></span> <span><%- Address %></span> </p> </div> <div> <p>Phone: <b><%- Phone %></b></p> <p>Fax: <b><%- Fax %></b></p> <p>Website: <a href="<%- Website %>" target="_blank"><%- Website %></a></p> </div> </div> </text>) ) <div class="options"> <div class="caption">Options</div> <div class="option"> @(Html.DevExtreme().CheckBox() .Text("Multiple enabled") .OnValueChanged("multipleMode_changed") ) </div> <div class="option"> @(Html.DevExtreme().CheckBox() .Text("Collapsible enabled") .OnValueChanged("collapsibleMode_changed") ) </div> <div class="option"> <span>Animation duration</span> @(Html.DevExtreme().Slider() .Min(0) .Max(1000) .Value(300) .Label(l => l.Visible(true)) .Tooltip(t => t .Enabled(true) .Position(VerticalEdge.Bottom) ) .OnValueChanged("slider_valueChanged") ) </div> <div class="option"> <span class="caption">Selected Items</span> @(Html.DevExtreme().TagBox() .ID("tagbox") .InputAttr("aria-label", "Company Name") .DisplayExpr("Name") .ValueExpr("ID") .Value(new[] { 1 }) .DataSource(d => d.Mvc().LoadAction("GetData").Key("ID")) .Disabled(true) .OnValueChanged("tagBox_valueChanged") ) </div> </div></div><script> function getAccordionInstance() { return $("#accordion-container").dxAccordion("instance"); } function getTagBoxInstance() { return $("#tagbox").dxTagBox("instance"); } function tagBox_valueChanged(e) { getAccordionInstance().option("selectedItemKeys", e.value); } function accordion_selectionChanged(e) { getTagBoxInstance().option("value", e.component.option("selectedItemKeys")); } function slider_valueChanged(e) { getAccordionInstance().option("animationDuration", e.value); } function multipleMode_changed(e) { var tagBox = getTagBoxInstance(), accordion = getAccordionInstance(); accordion.option("multiple", e.value); tagBox.option("disabled", !e.value); tagBox.option("value", accordion.option("selectedItemKeys")); } function collapsibleMode_changed(e) { getAccordionInstance().option("collapsible", e.value); }</script>xxxxxxxxxxusing DevExtreme.AspNet.Data;using DevExtreme.AspNet.Mvc;using DevExtreme.NETCore.Demos.Models.SampleData;using Microsoft.AspNetCore.Mvc;namespace DevExtreme.NETCore.Demos.Controllers { public class AccordionController : Controller { public ActionResult Overview() { return View(); } [HttpGet] public object GetData(DataSourceLoadOptions loadOptions) { return DataSourceLoader.Load(SampleData.Companies, loadOptions); } }}xxxxxxxxxxusing System.Collections.Generic;namespace DevExtreme.NETCore.Demos.Models.SampleData { public partial class SampleData { public static readonly IEnumerable<Company> Companies = new[] { new Company { ID = 1, Name = "Super Mart of the West", Address = "702 SW 8th Street", City = "Bentonville", State = "Arkansas", ZipCode = 72716, Phone = "(800) 555-2797", Fax = "(800) 555-2171", Website = "http://www.nowebsitesupermart.dx" }, new Company { ID = 2, Name = "Electronics Depot", Address = "2455 Paces Ferry Road NW", City = "Atlanta", State = "Georgia", ZipCode = 30339, Phone = "(800) 595-3232", Fax = "(800) 595-3231", Website = "http://www.nowebsitedepot.dx" }, new Company { ID = 3, Name = "K&S Music", Address = "1000 Nicllet Mall", City = "Minneapolis", State = "Minnesota", ZipCode = 55403, Phone = "(612) 304-6073", Fax = "(612) 304-6074", Website = "http://www.nowebsitemusic.dx" }, new Company { ID = 4, Name = "Tom's Club", Address = "999 Lake Drive", City = "Issaquah", State = "Washington", ZipCode = 98027, Phone = "(800) 955-2292", Fax = "(800) 955-2293", Website = "http://www.nowebsitetomsclub.dx" } }; }}xxxxxxxxxxusing System;using System.Collections.Generic;using System.Linq;namespace DevExtreme.NETCore.Demos.Models { public class Company { public int ID { get; set; } public string Name { get; set; } public string Address { get; set; } public string City { get; set; } public string State { get; set; } public int ZipCode { get; set; } public string Phone { get; set; } public string Fax { get; set; } public string Website { get; set; } }}xxxxxxxxxx#accordion { height: 700px;}#accordion .header { font-size: 20px;}#accordion .header,#accordion p { margin: 0;}#accordion-container { margin-right: 400px;}.dx-theme-material #accordion .dx-accordion-item-title { display: flex;}.dx-theme-material #accordion .header { align-self: center;}.options { padding: 20px; position: absolute; bottom: 0; right: 0; width: 340px; top: 0; background-color: rgba(191, 191, 191, 0.15);}.options > .caption { font-weight: 500; font-size: 18px;}.option { margin-top: 10px;}.option > .caption { margin-top: 10px; display: inline-block;}.option > .dx-tagbox { margin-top: 2px;}Bind Accordion to Data
You can display Accordion items from the items array or a dataSource. If you use the items array, specify the title and text properties.
Configure Item Selection and Collapsibility
Enable the multiple property to allow users to select multiple panels. Use the selectedItems array to store selected items. Toggle the "Multiple enabled" checkbox in the Options demo section to see how it affects the selection.
If you want to allow users to close panels on click, set the collapsible property to true. Check the "Collapsible enabled" checkbox in the Options demo section to enable this feature.
Configure Animation
The animationDuration property allows you to specify the animation duration when users expand/collapse a panel. Use the "Animation duration" slider in the Options demo section to see how it affects the animation.
Customize Item Appearance
Use the itemTemplate and itemTitleTemplate properties to customize the panel appearance. If you use the items array, you can also specify the icon property.