-
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
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Resizable
-
-
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
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
Drop Down Box - Single Selection
DropDownBox is an advanced editor whose drop-down window can include other components.
DevExtreme ships with multiple other drop-down editors. To find out which editor best suits your task, review the following article: How to Choose a Drop-Down Editor.
To get started with the DevExtreme DropDownBox component, refer to the following step-by-step tutorial: Getting Started with DropDownBox.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
<div class="dx-fieldset">
<div class="dx-field">
<div class="dx-field-label">DropDownBox with embedded TreeView</div>
<div class="dx-field-value">
@(Html.DevExtreme().DropDownBox()
.Value("1_1")
.ValueExpr("ID")
.DropDownOptions(o => o.Height(350))
.InputAttr("aria-label", "Owner")
.DisplayExpr("Text")
.DataSource(d => d.WebApi()
.Controller("TreeViewPlainData")
.LoadMode(DataSourceLoadMode.Raw)
.Key("ID")
)
.Placeholder("Select a value...")
.ShowClearButton(true)
.OnValueChanged("treeBox_valueChanged")
.ContentTemplate(new TemplateName("EmbeddedTreeViewSingle"))
)
<div id="treeBox"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">DropDownBox with embedded DataGrid</div>
<div class="dx-field-value">
@(Html.DevExtreme().DropDownBox()
.Value(3)
.ValueExpr("ID")
.InputAttr("aria-label", "Owner")
.DisplayExpr(new JS("gridBox_displayExpr"))
.DataSource(d => d.WebApi()
.Controller("DataGridCustomers")
.LoadMode(DataSourceLoadMode.Raw)
.Key("ID")
)
.Placeholder("Select a value...")
.ShowClearButton(true)
.OnValueChanged("gridBox_valueChanged")
.ContentTemplate(new TemplateName("EmbeddedDataGridSingle"))
)
</div>
</div>
</div>
@using(Html.DevExtreme().NamedTemplate("EmbeddedTreeViewSingle")) {
@(Html.DevExtreme().TreeView()
.DataSource(new JS(@"component.getDataSource()"))
.KeyExpr("ID")
.DisplayExpr("Text")
.ItemsExpr("Items")
.ExpandedExpr("Expanded")
.ParentIdExpr("CategoryId")
.DataStructure(TreeViewDataStructure.Plain)
.SelectionMode(NavSelectionMode.Single)
.SelectByClick(true)
.Height(235)
.OnItemClick(@<text>
function(args) {
component.close();
}
</text>)
.OnItemSelectionChanged(@<text>
function(args) {
component.option("value", args.component.getSelectedNodeKeys());
}
</text>)
.OnContentReady(@<text>
function(args) {
syncTreeViewSelection(args.component, component.option("value"));
}
</text>)
)
}
@using(Html.DevExtreme().NamedTemplate("EmbeddedDataGridSingle")) {
@(Html.DevExtreme().DataGrid()
.ID("embedded-datagrid")
.DataSource(new JS(@"component.getDataSource()"))
.Columns(columns => {
columns.Add().DataField("CompanyName");
columns.Add().DataField("City");
columns.Add().DataField("Phone");
})
.ShowBorders(true)
.HoverStateEnabled(true)
.Paging(p => p.PageSize(10))
.FilterRow(f => f.Visible(true))
.Scrolling(s => s.Mode(GridScrollingMode.Virtual))
.Height(345)
.Selection(s => s.Mode(SelectionMode.Single))
.SelectedRowKeys(new JS(@"component.option(""value"") ? [component.option(""value"")] : []"))
.OnSelectionChanged(@<text>
function(selectedItems) {
var keys = selectedItems.selectedRowKeys;
component.option("value", keys);
component.close();
}
</text>)
)
}
<script>
function syncTreeViewSelection(treeView, value) {
if (!value) {
treeView.unselectAll();
} else {
treeView.selectItem(value);
}
}
function treeBox_valueChanged(e) {
var $treeView = e.component.content().find(".dx-treeview");
if($treeView.length) {
syncTreeViewSelection($treeView.dxTreeView("instance"), e.value);
}
}
function gridBox_valueChanged(e) {
var $dataGrid = $("#embedded-datagrid");
if ($dataGrid.length) {
var dataGrid = $dataGrid.dxDataGrid("instance");
dataGrid.selectRows(e.value, false);
}
}
function gridBox_displayExpr(item) {
return item && item.CompanyName + " <" + item.Phone + ">";
}
</script>
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
In this demo, TreeView and the DataGrid components in single-selection mode are embedded into the DropDownBox window.
The following instructions show how to synchronize the DropDownBox with an embedded DevExtreme component:
-
Specify data sources
The DropDownBox and its embedded component can use the same or different data sources. If the data sources are different, you need to specify the embedded component's key field in the DropDownBox's data source. If the DropDownBox contains a DataGrid, bind the DataGrid to a store instead of a simple array (for example, an ArrayStore). -
Specify which data field contains the DropDownBox's values and the embedded component's keys
Assign the field's name to the DropDownBox's valueExpr property and to the key property of the embedded component's store. -
Synchronize the DropDownBox's value and the embedded component's selection
- Assign DropDownBox's initial value to the embedded component's selectedRowKeys/selectedItemKeys property (see the example with the DataGrid below). If the embedded component does not have such properties, implement the onContentReady handler (the example with the TreeView).
- Implement the DropDownBox's onValueChanged handler to update the selection when the value changes.
- Implement the embedded component's onSelectionChanged handler to update the DropDownBox's value when the selection changes.