Back to Devexpress

Batch Editing

aspnetmvc-120227-components-tree-list-data-editing-batch-editing.md

latest6.5 KB
Original Source

Batch Editing

  • Jul 15, 2024
  • 6 minutes to read

The ASP.NET MVC Tree List extension allows users to modify a batch of tree list data on the client side and send it to the server in a single request.

Overview

In batch editing mode, in-line editors are used to edit tree list data. All user data modifications are maintained on the client. Click Update to save changes on the server side, or Cancel to discard them.

Set the column’s TreeListColumnEditFormSettings.Visible (through MVCxTreeListColumn .EditFormSettings.Visible ) property to false to prevent an end-user from editing column cells. In this case, column cells cannot switch to edit mode. When an end-user navigates through cells using the TAB key, such column cells are skipped. In contrast to the aforementioned property, the TreeListColumnEditFormSettings.Visible setting allows you to hide a tree list column on the client side but keeps this column editable using the batch edit API.

Note

As the tree list modifies its data on the client side in batch edit mode, the server-side ASPxTreeList.StartEdit (through MVCxTreeList .StartEdit ) and ASPxTreeList.StartEditNewNode (through MVCxTreeList. StartEditNewNode ) methods are not in effect. Additionally, the client-side ASPxClientTreeList.StartEditNewNode (through MVCxClientTreeList. StartEditNewNode ) method does not perform a callback.

The tree list displays a “confirm” message before a tree list callback is performed if it contains modified data. Customize the message text using the TreeListSettingsText.ConfirmOnLosingBatchChanges (through TreeListSettings.SettingsText .ConfirmOnLosingBatchChanges ) property, or disable it by setting the GridBatchEditSettings.ShowConfirmOnLosingChanges (by setting the MVCxTreeList.SettingsEditing .BatchEditSettings.ShowConfirmOnLosingChanges ) property to false.

The TreeListBatchEditSettings.EditMode (through TreeListSettings.SettingsEditing .BatchEditSettings.EditMode ) property allows you to specify which control element (data cell or node) to use for data editing.

Enabling Batch Data Editing in the Tree List

Enable the Tree List batch editing functionality using one of the following ways.

  1. Add a controller action method to implement the following data record operations: add new records , save updated records and delete existing records within a data source.

  2. Define callback route values within the PartialView.

  3. Enable the command column and command items.

Appearance Customization

To customize the modified data item’s visual presentation, use the following TreeListSettings.Styles property settings.

Online Demo

TreeList - Batch Editing and Updating

Batch Edit Mode Limitations

The following TreeList’s features and API members are not in effect in batch edit mode, since all user changes are maintained on the client side.

Unsupported features

The features below are not supported when the tree list is in batch edit mode:

  • The select check boxes of newly created nodes are disabled until the nodes are saved.
  • You cannot use the UploadControl to modify new row values in batch edit mode.
  • The BinaryImage control does not have any built-in functionality allowing you to determine if the editor is focused (the client-side ASPxClientEdit.GotFocus and ASPxClientEdit.LostFocus events do not work). This imposes the following limitations on using BinaryImage in batch edit mode:

Unsupported server-side API

The following server-side events are not in effect when the tree list is in batch edit mode:

The ValidationSettings.SetFocusOnError property has no effect, because the extension handles errors at the node/cell level. Use the GridBatchEditSettings.AllowEndEditOnValidationError property to keep focus on the editor until an end-user inputs a correct value.

  • Unsupported client-side API