All docs
V19.1
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
17.2
Box
Row
Map
Vue
A newer version of this page is available. Switch to the current version.

jQuery DataGrid - editing

Configures editing.

Type:

Object

The widget can allow a user to add, update and delete data. To control which of these operations are allowed, use the allowAdding, allowUpdating and allowDeleting options. Editing can be carried out in different modes, which are detailed in the mode option's description.

NOTE
Before allowing a user to add, update, and delete, make sure that your data source supports these actions.

View Demo

See Also

allowAdding

Specifies whether a user can add new rows.

Type:

Boolean

Default Value: false

allowDeleting

Specifies whether a user can delete rows. It is called for each data row when defined as a function.

Type:

Boolean

|

Function

Function parameters:
options:

Object

Information about the current row.

Object structure:
Name Type Description
component

DataGrid

The widget's instance.

row

DataGrid Row

The row's properties.

Return Value:

Boolean

true if the row can be deleted; otherwise false.

Default Value: false

The following code allows a user to delete only even data rows:

jQuery
JavaScript
$(function(){
    $("#dataGridContainer").dxDataGrid({
        // ...
        editing: {
            allowDeleting: function(e) {
                if(e.row.rowIndex % 2 == 1) { return true }; 
                return false;
            },
        }
    })
})
Angular
TypeScript
HTML
import { DxDataGridModule } from "devextreme-angular";
// ...
export class AppComponent {
    allowDeleting(e) {
        if(e.row.rowIndex % 2 == 1) { return true }; 
        return false;
    }
}
@NgModule({
    imports: [
        // ...
        DxDataGridModule
    ],
    // ...
})
<dx-data-grid ... >
    <dxo-editing
        [allowDeleting]="allowDeleting">
    </dxo-editing>
</dx-data-grid>
See Also

allowUpdating

Specifies whether a user can update rows. It is called for each data row when defined as a function.

Type:

Boolean

|

Function

Function parameters:
options:

Object

Information about the current row.

Object structure:
Name Type Description
component

DataGrid

The widget's instance.

row

DataGrid Row

The row's properties.

Return Value:

Boolean

true if the row can be updated; otherwise false.

Default Value: false

form

Configures the form. Used only if editing.mode is "form" or "popup".

Default form editors depend on the columns' configuration. If the generated form does not meet your requirements, and you need to reorganize form items or set other form options, specify it in the form object. To link a form item with a grid column, assign identical values to the form.items.dataField and columns.dataField options.

jQuery
index.js
$(function() {
    $("#dataGridContainer").dxDataGrid({
        // ...
        editing: {
            allowUpdating: true,
            mode: "form",
            form: {
                items: [{
                    itemType: "group",
                    caption: "Personal Data",
                    items: [
                        { dataField: "Prefix" },
                        { dataField: "Full_Name" },
                        { dataField: "Position" },
                        { dataField: "Duties", editorType: "dxTextArea" }
                    ]
                    // or simply
                    // items: ["Prefix", "Full_Name", "Position"]
                }, {
                    itemType: "group",
                    caption: "Contacts",
                    items: ["Email", "Skype"]
                }]
            }
        },
        columns: [ 
            { dataField: "Full_Name" }, 
            { dataField: "Prefix" },
            { dataField: "Position" },
            { dataField: "Duties" },
            { dataField: "Email" },
            { dataField: "Skype" } 
        ]
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-data-grid ... >
    <dxo-editing
        [allowUpdating]="true"
        mode="form">
        <dxo-form>
            <dxi-item itemType="group" caption="Personal Data">
                <dxi-item dataField="Prefix"></dxi-item>
                <dxi-item dataField="Full_Name"></dxi-item>
                <dxi-item dataField="Position"></dxi-item>
                <dxi-item dataField="Duties" editorType="dxTextArea"></dxi-item>
            </dxi-item>
            <dxi-item itemType="group" caption="Contacts">
                <dxi-item dataField="Email"></dxi-item>
                <dxi-item dataField="Skype"></dxi-item>
            </dxi-item>
        </dxo-form>
    </dxo-editing>
    <dxi-column dataField="Full_Name"></dxi-column>
    <dxi-column dataField="Prefix"></dxi-column>
    <dxi-column dataField="Position"></dxi-column>
    <dxi-column dataField="Duties"></dxi-column>
    <dxi-column dataField="Email"></dxi-column>
    <dxi-column dataField="Skype"></dxi-column>
</dx-data-grid>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxDataGridModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxDataGridModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
ASP.NET MVC Controls
Razor C#
@(Html.DevExtreme().DataGrid()
    // ...
    .Editing(e => e
        .AllowUpdating(true)
        .Mode(GridEditMode.Form)
        .Form(f => f
            .Items(i => {
                i.AddGroup()
                    .Caption("Personal Data")
                    .Items(groupItems => {
                        groupItems.AddSimple().DataField("Prefix");
                        groupItems.AddSimple().DataField("Full_Name");
                        groupItems.AddSimple().DataField("Position");
                        groupItems.AddSimple().DataField("Duties")
                            .Editor(e => e.TextArea());
                    });
                i.AddGroup()
                    .Caption("Contacts")
                    .Items(groupItems => {
                        groupItems.AddSimple().DataField("Email");
                        groupItems.AddSimple().DataField("Skype");
                    });
            })
        )
    )
    .Columns(cols => {
        cols.Add().DataField("Full_Name");
        cols.Add().DataField("Prefix");
        cols.Add().DataField("Position");
        cols.Add().DataField("Duties");
        cols.Add().DataField("Email");
        cols.Add().DataField("Skype");
    })
)
Vue
App.vue
<template>
    <DxDataGrid ... >
        <DxEditing
            :allow-updating="true"
            mode="form">
                <DxForm>
                    <DxItem itemType="group" caption="Personal Data">
                        <DxItem dataField="Prefix" />
                        <DxItem dataField="Full_Name" />
                        <DxItem dataField="Position" />
                        <DxItem dataField="Duties" editorType="dxTextArea" />
                    </DxItem>
                    <DxItem itemType="group" caption="Contacts">
                        <DxItem dataField="Email" />
                        <DxItem dataField="Skype" />
                    </DxItem>
                </DxForm>
        </DxEditing>
        <DxColumn data-field="Full_Name" />
        <DxColumn data-field="Prefix" />
        <DxColumn data-field="Position" />
        <DxColumn data-field="Duties" />
        <DxColumn data-field="Email" />
        <DxColumn data-field="Skype" />
    </DxDataGrid>
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import DxDataGrid, { DxColumn, DxEditing, DxForm } from 'devextreme-vue/data-grid';
import { DxItem } from 'devextreme-vue/form';

export default {
    components: {
        DxDataGrid,
        DxEditing,
        DxForm,
        DxItem
    },
    data() {
        return {
            // ...
        }
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import DataGrid, {
    Column,
    Editing,
    Form
} from 'devextreme-react/data-grid';
import { Item } from 'devextreme-react/form';

class App extends React.Component {
    render() {
        return (
            <DataGrid ... >
                <Editing
                    mode="form"
                    allowUpdating={true}>
                    <Form>
                        <Item itemType="group" caption="Personal Data">
                            <Item dataField="Prefix" />
                            <Item dataField="Full_Name" />
                            <Item dataField="Position" />
                            <Item dataField="Duties" editorType="dxTextArea" />
                        </Item>
                        <Item itemType="group" caption="Contacts">
                            <Item dataField="Email" />
                            <Item dataField="Skype" />
                        </Item>
                    </Form>
                </Editing>
                <Column dataField="Prefix" />
                <Column dataField="Full_Name" />
                <Column dataField="Position" />
                <Column dataField="Duties" />
                <Column dataField="Email" />
                <Column dataField="Skype" />
            </DataGrid>
        );
    }
}
export default App;
NOTE

You cannot specify the following options in the form object:

Also, the colCount option defaults to 2, but it can be redefined.

NOTE
The fields of a configuration object passed to this option do not support two-way binding in Angular, AngularJS, and Knockout and event bindings in Angular.

If you need to customize an individual form item, use the formItem object.

See Also

mode

Specifies how a user edits data.

Type:

String

Default Value: 'row'
Accepted Values: 'batch' | 'cell' | 'row' | 'form' | 'popup'

The following list points out the differences in editing modes.

  • Row
    A user edits one row at a time. The widget saves changes when the row leaves the editing state. See demo.
  • Batch
    A user edits data cell by cell. The widget does not save changes until a user clicks the global "Save" button. See demo.
  • Cell
    Differs from the batch mode in that the widget saves changes when the cell leaves the editing state. See demo.
  • Form
    On entering the editing state, a row becomes a form with editable fields. The widget saves changes after a user clicks the "Save" button. See demo.
  • Popup
    Differs from the form mode in that the form with editable fields is placed in a popup window. See demo.

Use the GridEditMode enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: Row, Batch, Cell, Form, and Popup.

popup

Configures the popup. Used only if editing.mode is "popup".

You can specify most of the Popup options in this object except those listed below. The DataGrid overrides these options.

The popup always contains a form whose items are used for editing. Use the form option to customize the form items.

NOTE
The fields of a configuration object passed to this option do not support two-way binding in Angular, AngularJS, and Knockout and event bindings in Angular.

View Demo

refreshMode

Specifies operations that are performed after saving changes.

Type:

String

Default Value: 'full'
Accepted Values: 'full' | 'reshape' | 'repaint'

The following table shows the operations that are performed after saving changes in different modes:

Mode Data reloading Data processing operations* Widget repaint**
full + + +
reshape - *** +
(on the client)
+
repaint - - +
* - Data processing operations include paging, filtering, sorting, grouping, and summary calculation (in the DataGrid).
** - Set repaintChangesOnly to true to repaint only elements whose data changed.
*** - Set remoteOperations to false and cacheEnabled to true to avoid data reloading.
NOTE

When the refreshMode is "reshape" or "repaint", the server should respond to the insert or update request by sending back the data item saved in the database. See the DataGridWebApiController tab in the CRUD Operations demo for an example of the server-side implementation. The InsertOrder and UpdateOrder actions illustrate this case.

Use the GridEditRefreshMode enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: Full, Reshape, and Repaint.

selectTextOnEditStart

Specifies whether to select text in a cell when a user starts editing.

Type:

Boolean

Default Value: false

startEditAction

Specifies whether a single or double click should switch a cell to the editing state. Applies if editing.mode is "cell" or "batch".

Type:

String

Default Value: 'click'
Accepted Values: 'click' | 'dblClick'

View Demo

See Also

texts

Contains options that specify texts for editing-related UI elements.

Type:

Object

The following code shows the editing.texts declaration syntax:

jQuery
index.js
$(function() {
    $("#dataGridContainer").dxDataGrid({
        // ...
        editing: {
            // ...
            texts: {
                deleteRow: "Remove"
            }
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-data-grid ... >
    <dxo-editing ... >
        <dxo-texts
            deleteRow="Remove">
        </dxo-texts>
    </dxo-editing>
</dx-data-grid>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxDataGridModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxDataGridModule
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxDataGrid ... >
        <DxEditing ... >
            <DxTexts
                delete-row="Remove"
            />
        </DxEditing>
    </DxDataGrid> 
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import DxDataGrid, {
    DxEditing,
    DxTexts
} from 'devextreme-vue/data-grid';

export default {
    components: {
        DxDataGrid,
        DxEditing,
        DxTexts
    },
    data() {
        // ...
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import DataGrid, {
    Editing,
    Texts
} from 'devextreme-react/data-grid';

class App extends React.Component {
    render() {
        return (
            <DataGrid ... >
                <Editing>
                    <Texts
                        deleteRow="Remove"
                    />
                </Editing>
            </DataGrid>
        );
    }
}
export default App;

useIcons

Specifies whether the editing column uses icons instead of links.

Type:

Boolean

Default Value: false, true (Material)