Your search did not match any results.
Data Grid

Edit State Management (CTP)

Our DataGrid component manages its edit state automatically. If your use case requires full control over the editing process, you can use the API members below to manage state manually.

Component Properties

  • editing.editRowKey
    The key for the row being edited.

  • editing.editColumnName
    The name or data field of the column being edited.

  • editing.changes
    Pending row changes.

You can get and set these properties at runtime to access and change edit state. In this demo, the onOptionChanged function gets editRowKey and changes property values and displays them under the DataGrid.

Utility Method

Event Handlers

  • onSaving / onSaved
    Functions that are called before / after pending row changes are saved via the UI or programmatically.

  • onEditCanceling / onEditCanceled
    Functions that are called before / after editing is canceled and pending row changes are discarded.

Use these functions to perform custom actions. In this demo, the onSaving function sends pending changes to a server. The function's parameter e contains fields for this capability. To implement the same in your application, follow these steps:

  1. Disable built-in edit state management
    Set the e.cancel field to true.

  2. Send a request to the server
    Pending changes are stored in the e.changes array. This array has only a single element in all edit modes, except for batch. Check if this element is not empty and send it to the server.

  3. Apply the same changes to a local array
    If the server successfully saves changes, call the applyChanges method to save the same changes in a local array.

  4. Update the DataGrid's data source and reset edit state
    Assign the local array to the dataSource, null to the editRowKey, and an empty array to the changes property.

NOTE

This functionality is available as a community technology preview (CTP). Should you have any questions or suggestions prior to its official release, please email your comments to support@devexpress.com. You can also share your feedback on this feature's discussion page.

Thank you for your interest in our ASP.NET Core product libraries and UI component suite. We are moving ASP.NET Core-related demos and content to DevExpress.com. Please make sure to update your bookmarks with our new URL.

View Demo