-
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
- Box
- Responsive Box
- 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
- Overview
-
Action Sheet
-
Button
- Floating Action Button
- Drop Down Button
-
Context Menu
-
List
-
Lookup
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
React Tree List - Form Editing
The TreeList can use the Form component to arrange cell editors when users modify a row. The Form allows users to edit values from visible and hidden columns.
To enable form edit mode, configure the following properties:
- Set editing.mode to "form"
- Assign true to the editing object's allowAdding, allowUpdating, and allowDeleting properties.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
import React from 'react';
import {
TreeList, Editing, Column, ValidationRule, Lookup, Button, TreeListTypes,
} from 'devextreme-react/tree-list';
import { employees } from './data.ts';
const expandedRowKeys = [1, 2, 3, 4, 5];
const lookupData = {
store: employees,
sort: 'Full_Name',
};
const allowDeleting = (e) => e.row.data.ID !== 1;
const onEditorPreparing = (e: TreeListTypes.EditorPreparingEvent) => {
if (e.dataField === 'Head_ID' && e.row.data.ID === 1) {
e.editorOptions.disabled = true;
e.editorOptions.value = null;
}
};
const onInitNewRow = (e: TreeListTypes.InitNewRowEvent) => {
e.data.Head_ID = 1;
};
const App = () => (
<div id="tree-list-demo">
<TreeList
id="employees"
dataSource={employees}
columnAutoWidth={true}
showRowLines={true}
showBorders={true}
defaultExpandedRowKeys={expandedRowKeys}
keyExpr="ID"
parentIdExpr="Head_ID"
onEditorPreparing={onEditorPreparing}
onInitNewRow={onInitNewRow}
>
<Editing allowUpdating={true} allowDeleting={allowDeleting} allowAdding={true} mode="form" />
<Column dataField="Full_Name">
<ValidationRule type="required" />
</Column>
<Column dataField="Prefix" caption="Title">
<ValidationRule type="required" />
</Column>
<Column visible={false} dataField="Head_ID" caption="Head">
<Lookup dataSource={lookupData} valueExpr="ID" displayExpr="Full_Name" />
<ValidationRule type="required" />
</Column>
<Column dataField="Title" caption="Position">
<ValidationRule type="required" />
</Column>
<Column width={150} dataField="City">
<ValidationRule type="required" />
</Column>
<Column width={120} dataField="Hire_Date" dataType="date">
<ValidationRule type="required" />
</Column>
<Column type="buttons">
<Button name="edit" />
<Button name="delete" />
</Column>
</TreeList>
</div>
);
export default App;
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
A column's default editor is defined automatically based on this column's dataType. To customize this editor or replace it with another editor, use the column's formItem object. For information on settings that you can define in the formItem object, refer to the SimpleItem help topic.
You can also set up the edit Form from scratch. The component's configuration section lists available settings. Specify these settings in the editing.form object. Refer to this object's description for information about form edit mode limitations.
This demo also illustrates the following event handlers:
-
onInitNewRow
Populates form editors of a new row with default values. In this demo, onInitNewRow sets "John Heart" as the initialHead
for new rows. -
onEditorPreparing
Customizes form editors. In this demo, this handler forbids users to edit theHead
value of John Heart.
Refer to the following help topic to see the full list of the events that edit operations raise: Editing Events.