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. Image for the cookie policy date

Focus in the first editable column after add in datagrid is not working in latest version.

Hi team,

this worked in version 19 but no longer working after I upgraded to version 20 or later.



here is my sample code.


@page "/"

@using Syncfusion.Blazor.Inputs

@using Syncfusion.Blazor.Grids

@inject IJSRuntime Runtime


s



@code{

public List Orders { get; set; }

public void CellEdit(CellEditArgs Args)

{

Runtime.InvokeVoidAsync("select", Args.ColumnName);

}

protected override void OnInitialized()

{

Orders = Enumerable.Range(1, 75).Select(x => new Order()

{

OrderID = 1000 + x,

CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],

Freight = 2.1 * x,

OrderDate = DateTime.Now.AddDays(-x),

}).ToList();

}


public class Order

{

public int? OrderID { get; set; }

public string CustomerID { get; set; }

public DateTime? OrderDate { get; set; }

public double? Freight { get; set; }

}

}



I know it will work using EditCellAsync but I don't know the event where I can apply it. By the way I'm using batch mode..

hope you can help me,

best regards,


Tyrone


3 Replies

BL Balamurugan Lakshmanan Syncfusion Team January 30, 2023 01:25 PM UTC

Hi Tyrone,


Greeting from Syncfusion support.


Generally as per the default  condition if we click add in toolbar , new row will generate as a first row. In this new row we can perform CRUD operations. Kindly refer this attached solution file and UG documentation for your reference.



https://blazor.syncfusion.com/documentation/datagrid/editing


If you face still face this issue, Kindly share us the following things:

    1.The entire Grid code snippet.

    2.Share more details about your requirement elaborately

    3.Share us the video demonstration of the issue with replication procedure.

    4.If possible kindly share us the issue reproduceable sample. 


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Bala


Attachment: BlazorApp1_9c83fb41.zip


TY Tyrone January 31, 2023 02:31 AM UTC

Hi Bala,


Thanks for the reply. I just noticed that it is working on Normal Mode but not on Batch Mode.. I need it on batch mode since all my grids are designed to it..


Thus, It only works in 1st column if allowadding is set to true. But what I need is that it should be focus at the 2nd column ( CustomerID). I don't need to focus in the 1st column since my primary key is read only and auto generated by API.




Is there another way around?

please refer also to my attachment,


Best Regards,


Tyrone.


Attachment: BlazorApp1_9c83fb41Batch_eb3e8576.rar



BL Balamurugan Lakshmanan Syncfusion Team January 31, 2023 11:48 AM UTC

Hi Tyrone,


We understand that when you click the add button, you would like the focus to be placed on the first editable column. We have implemented this in our sample for you. In our sample, the first 3 columns are non-editable (read-only) and when you click the add button, the focus will be placed on the 4th column. Please refer to the attached sample and video demonstration for your reference.


Please let us know if you have any concerns.


Regards,

Bala


Attachment: syncfusionBlazor_24d099a0.zip

Loader.
Up arrow icon