-
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
Tree List - Column Chooser
If you want users to change column visibility at runtime, enable the Column Chooser. Set the columnChooser.enabled property to true. Note that you can make sure that certain columns always stay visible. To do so, set the columns[].allowHiding property to false.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
@using DevExtreme.MVC.Demos.Models.TreeList
@using DevExtreme.MVC.Demos.Models
@model IEnumerable<Employee>
@(Html.DevExtreme().TreeList<Employee>()
.ID("employees")
.DataSource(Model)
.KeyExpr("ID")
.ParentIdExpr("HeadID")
.Columns(column => {
column.AddFor(m => m.Title);
column.AddFor(m => m.FullName)
.AllowHiding(false);
column.AddFor(m => m.City);
column.AddFor(m => m.State);
column.Add()
.Caption("Contacts")
.Columns(a => {
a.AddFor(m => m.MobilePhone)
.AllowHiding(false);
a.AddFor(m => m.Email);
a.AddFor(m => m.Skype)
.Visible(false);
});
column.AddFor(m => m.HireDate);
})
.ColumnAutoWidth(true)
.ShowRowLines(true)
.ShowBorders(true)
.ColumnChooser(cc => {
cc
.Enabled(true)
.Mode(GridColumnChooserMode.Select)
.Position(pc => pc
.My(HorizontalAlignment.Right, VerticalAlignment.Top)
.At(HorizontalAlignment.Right, VerticalAlignment.Bottom)
.Of(".dx-treelist-column-chooser-button")
);
cc.Search(ccs => ccs
.Enabled(true)
.EditorOptions(new { Placeholder = "Search column" })
);
cc.Selection(ccs => ccs
.AllowSelectAll(true)
.SelectByClick(true)
.Recursive(true)
);
})
.ExpandedRowKeys(new[] { 1, 5 })
)
<div class="options">
<div class="caption">Options</div>
<div class="selectboxes-container">
<div class="option">
<span>Column chooser mode</span>
@{
var dataSource = new[] {
new ColumnChooserMode {
Key = "dragAndDrop",
Name = "Drag and drop"
},
new ColumnChooserMode {
Key = "select",
Name = "Select"
}
};
}
@(Html.DevExtreme().SelectBox()
.DataSource(dataSource)
.Value(dataSource[1].Key)
.ValueExpr("Key")
.InputAttr("aria-label", "Column Chooser Mode")
.DisplayExpr("Name")
.OnValueChanged(@<text>
function(data) {
var treeList = $("#employees").dxTreeList("instance");
treeList.option("columnChooser.mode", data.value);
const isDragMode = dataSource[0].key === data.value;
$('#allowSelectAll').dxCheckBox('instance').option('disabled', isDragMode);
$('#selectByClick').dxCheckBox('instance').option('disabled', isDragMode);
$('#recursive').dxCheckBox('instance').option('disabled', isDragMode);
}
</text>)
)
</div>
</div>
<div class="checkboxes-container">
<div class="option">
@(Html.DevExtreme().CheckBox()
.Text("Search enabled")
.Value(true)
.OnValueChanged(@<text>
function(data) {
var treeList = $("#employees").dxTreeList("instance");
treeList.option("columnChooser.search.enabled", data.value);
}
</text>)
)
</div>
<div class="option">
@(Html.DevExtreme().CheckBox()
.ID("allowSelectAll")
.Text("Allow select all")
.Value(true)
.OnValueChanged(@<text>
function(data) {
var treeList = $("#employees").dxTreeList("instance");
treeList.option("columnChooser.selection.allowSelectAll", data.value);
}
</text>)
)
</div>
<div class="option">
@(Html.DevExtreme().CheckBox()
.ID("selectByClick")
.Text("Select by click")
.Value(true)
.OnValueChanged(@<text>
function(data) {
var treeList = $("#employees").dxTreeList("instance");
treeList.option("columnChooser.selection.selectByClick", data.value);
}
</text>)
)
</div>
<div class="option">
@(Html.DevExtreme().CheckBox()
.ID("recursive")
.Text("Recursive")
.Value(true)
.OnValueChanged(@<text>
function(data) {
var treeList = $("#employees").dxTreeList("instance");
treeList.option("columnChooser.selection.recursive", data.value);
}
</text>)
)
</div>
</div>
</div>
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
To open the column chooser, users should click the button in the toolbar above the TreeList. The way users show and hide columns depends on the columnChooser.mode:
-
"dragAndDrop"
Users drag and drop column headers to and from the column chooser. -
"select"
Users select and deselect check boxes with column names.
In "select" mode, you can choose whether parent element selection affects child/nested elements. Use the selection.recursive property.
If the column chooser contains many hidden columns, you can enable the column search UI. Assign true to the search.enabled property.
In this demo, use the check boxes below the TreeList to toggle the selection and search features.
To hide a column in code, set the columns[].visible property to false.