Editing Basics

You can create, update, and delete the data records of the TreeList.

The TreeList Package is part of KendoReact, a professionally built commercial UI library. To try out this TreeList you need to sign up for a 30-day trial, which gives you access to the full KendoReact library.

Getting Started

  1. Set the editField property of the TreeListeditField will indicate the editable data items and is part of the temporary data items that are used during editing. For the data items in the edit mode, set the edit state in their editField. In the following example, the id of the edited item is stored in the application state.

        dataItem.inEdit = true;
  2. Create a new data tree which has the edit state of each data item by using the mapTree function.

                mapTree(data, subItemsField, item =>
                    extendDataItem(item, subItemsField, {
                        inEdit: item.id === this.state.editId
  3. Set the editCell property per column. The built-in editor components are the TreeListTextEditor, TreeListNumericEditor, TreeListDateEditor, and TreeListBooleanEditor. The usage of each component for each column depends on the type of the edited data.

                { field: 'name', editCell: TreeListTextEditor, ... },
                { field: 'position', editCell: TreeListTextEditor, ... },
                { field: 'hireDate', editCell: TreeListDateEditor, ... },
                { field: 'timeInPosition', editCell: TreeListNumericEditor, ... },
                { field: 'fullTime', editCell: TreeListBooleanEditor, ... }
  4. Define a function for the onItemChange event which will handle the data changes during editing. Inside the event, all relevant data, such as the edited data item, the newly entered value, or the edited field will be available as onItemChange parameters.

         <TreeList onItemChange={this.onItemChange}>
        onItemChange = (event) => {
                data: mapTree(
                    item => item.id === event.dataItem.id ?
                        extendDataItem(item, subItemsField, { [event.field]: event.value }) : item

The following example demonstrates how to set the TreeList in edit mode.

View Source
Edit In Stackblitz  
Change Theme:

Edit Modes

In this article

Not finding the help you need?