Skip to main content

ASPxClientGridViewBatchEditApi.StartEdit(visibleIndex, columnIndex) Method

Switches the specified cell to edit mode.

Declaration

StartEdit(
    visibleIndex: number,
    columnIndex: number
): void

Parameters

Name Type Description
visibleIndex number

The visible index of the row that contains the processed cell.

columnIndex number

The index of the column that contains the processed cell.

Remarks

When the GridView.SettingsEditing.Mode property is set to Batch, call the StartEdit method to switch the specified cell to edit mode.

The following example demonstrates how to switch a particular cell to edit mode in the BatchEditStartEditing event handler. Note that in this example, a StartEdit method call has no effect if the EditMode property is set to Row.

<dx:ASPxGridView ID="Grid" ClientInstanceName="ClientGrid" runat="server" KeyFieldName="ProductID"
    AutoGenerateColumns="False">
    <Columns>
        <!-- ... -->
        <dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="2" />
        <dx:GridViewDataTextColumn FieldName="CategoryName" VisibleIndex="3" />
        <dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="4" />
        <!-- ... -->
    </Columns>
    <SettingsEditing Mode="Batch" />
    <ClientSideEvents BatchEditStartEditing="OnBatchEditStartEditing" />
</dx:ASPxGridView>
function OnBatchEditStartEditing(s, e) {
    if (e.focusedColumn.fieldName === "ProductName" || e.focusedColumn.fieldName === "CategoryName") {
        e.cancel = true;

        var columnIndex = s.GetColumnByField('UnitPrice').index;
        window.setTimeout(function () {
            s.batchEditApi.StartEdit(e.visibleIndex, columnIndex);
        }, 0);
    }
}
See Also