-
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 - Row Editing
The TreeList allows users to edit data in multiple modes. This demo shows the "row" edit mode. To edit a row, click its "Edit" button. Only one row can be in the edit state at a time.
To enable row edit mode, set the mode property to "row" and enable the editing object's allowUpdating, allowAdding, and allowDeleting properties to allow edit operations.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
<div id="tree-list-demo">
@(Html.DevExtreme().TreeList<DevExtreme.MVC.Demos.Models.TreeList.Employee>()
.ID("employees")
.DataSource(ds => ds.WebApi()
.Controller("TreeListEditingEmployees")
.InsertAction(true)
.UpdateAction(true)
.DeleteAction(true)
.Key("ID")
)
.KeyExpr("ID")
.ParentIdExpr("HeadID")
.ShowRowLines(true)
.ShowBorders(true)
.Editing(editing => editing
.Mode(GridEditMode.Row)
.AllowUpdating(true)
.AllowDeleting(new JS("allowDeleting"))
.AllowAdding(true)
)
.Columns(columns => {
columns.AddFor(m => m.FullName);
columns.AddFor(m => m.HeadID)
.Lookup(lookup => lookup
.DataSource(ds => ds.WebApi().Controller("TreeListEditingEmployees").Key("ID"))
.DataSourceOptions(dso => dso.Sort(sort => sort.AddSorting("FullName")))
.ValueExpr("ID")
.DisplayExpr("FullName")
);
columns.AddFor(m => m.Title);
columns.AddFor(m => m.HireDate)
.Width(120);
columns.Add()
.Type(TreeListCommandColumnType.Buttons)
.Buttons(b => {
b.Add().Name(TreeListColumnButtonName.Edit);
b.Add().Name(TreeListColumnButtonName.Delete);
});
})
.ColumnAutoWidth(true)
.OnEditorPreparing("treeList_onEditorPreparing")
.OnInitNewRow("treeList_onInitNewRow")
.ExpandedRowKeys(new[] { 1, 2, 3, 4, 5 })
)
</div>
<script>
function treeList_onEditorPreparing(e) {
if(e.dataField === "HeadID" && e.row.data.ID === 1) {
e.cancel = true;
}
}
function treeList_onInitNewRow(e) {
e.data.HeadID = 1;
}
function allowDeleting(e) {
return e.row.data.ID !== 1;
}
</script>
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
Buttons for allowed edit operations are displayed in an edit column. To customize it programmatically, declare a column of the buttons
type and specify the available buttons. In this demo, the buttons
column is used to hide the "Add" button in each row. See the following help topic for more details on edit column customization: Customize the Edit Column.
This demo also illustrates the following event handlers:
-
onInitNewRow
Populates cells of a new row with default values. In this demo, onInitNewRow sets John Heart as the initial Head for new rows. -
onEditorPreparing
Customizes cell editors. In this demo, this handler disallows users to edit the Head value of John Heart.
Refer to the following help topic to see the full list of the events that edit operations raise: Editing Events.