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.