We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Editing rows

Thread ID:

Created:

Updated:

Platform:

Replies:

123501 Mar 23,2016 06:44 AM Mar 24,2016 01:55 AM ASP.NET Web Forms 1
loading
Tags: Grid
Jorge Pampin
Asked On March 23, 2016 06:44 AM

Hello,

In edit mode Normal, when I do double clic in a cell to edit the row, the cursor is moved to the first cell, are there any way to maintain the cursor in the cell where I do double clic?

Thanks!

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On March 24, 2016 01:55 AM

Hi Jorge,

You can use Batch edit mode to focus the currently clicked cell after rendering the edit form. Refer to the following code example and Help Document.

    <ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowGrouping="true" AllowPaging="True">

        <EditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" EditMode="Batch" />

        <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,save,delete,cancel"></ToolbarSettings>

        <Columns>

                . . .

        </Columns>

    </ej:Grid>


Help Document: http://help.syncfusion.com/aspnet/grid/editing#batch--excel-like

Refer to our Online demo on batch editing.

http://asp.syncfusion.com/demos/web/grid/batchediting.aspx

However, you can use the similar functionality with the inline editing mode using the following solution.

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

    <ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowGrouping="true" AllowPaging="True">

        <EditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" />

        <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,save,delete,cancel"></ToolbarSettings>

        <Columns>

            . . . . . .. .

        </Columns>

        <ClientSideEvents RecordDoubleClick="doubleClick" ActionComplete="actionComplete" />

    </ej:Grid>


    <script>

        function doubleClick(args) {

            this.model.columnName = this.getColumnByIndex(args.cellIndex).field;

        }

        function actionComplete(args) {

            if (args.requestType == "beginedit") {

                var elem = $("#MainContent_FlatGrid" + this.model.columnName);

                if (elem.hasClass("e-dropdownlist"))

                    elem.closest(".e-ddl").focus();

                else if (elem.hasClass("e-numerictextbox"))

                    elem.siblings('input:visible').first().select().focus();

                else

                    elem.focus().select();

            }

        }

    </script>
</asp:Content>


In the RecordDoubleClick, we can get the column name using cell index. Based on the  column name, you can focus the element that you have clicked in the ActionComplete event. Here, this.model.columnName is implicit variable and we are adding it manually.

Refer to the following Help Document.

http://help.syncfusion.com/js/api/ejgrid#events:recorddoubleclick
http://help.syncfusion.com/js/api/ejgrid#events:actioncomplete

We have prepared a sample that can be downloaded from the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/123501/ze/ASPGrid_Inline553567259

Regards,
Seeni Sakthi Kumar S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;