Grid rendering delayed when calling Grid.EditCellAsync(...)

Hi Team,

In the attached example, I have a keyhandler for the column customer id, that when Tab is pressed, I intend to manually:

- End editing so I can save changes to my db

- begin editing the next cell.


However, when calling Grid.EditCellAsync() it works, but only after I navigate away from the page and back again. For example, after making a change in a cell in column "CustomerID", press tab, and open a new tab or minimize the browser, then revisit the page again, only then it begins the edit mode for the next cell..

So seems like it is a rendering issue? 


Attachment: ServerApp_325ee86e.zip

1 Reply

RS Renjith Singh Rajendran Syncfusion Team May 17, 2022 06:21 AM UTC

Hi Shannon,


Greetings from Syncfusion support.


Based on this scenario, we suggest you to call the EditCellAsync method inside OnActionComplete event handler. Please refer and use as like the code below. We have also attached a modified sample in this ticket.


 

<GridEvents OnActionComplete="OnActionComplete" TValue="OrdersDetails"></GridEvents>

 

    public async Task OnActionComplete(ActionEventArgs<OrdersDetails> args)

    {

        if (args.RequestType.Equals(Action.BatchSave) && isTabPressed)

        {

            isTabPressed = false;

            var rowIndex = await Grid.GetRowIndexByPrimaryKeyAsync(OrderIDValue);

            await Grid.EditCellAsync(rowIndex, leftFieldName);

        }

    }

    public bool isTabPressed = false;

    public int? OrderIDValue { get; set; }

    public string leftFieldName { get; set; }

    public async Task KeyDownHandler(KeyboardEventArgs args, int? OrderID, string leftField)

    {

        if (Grid.IsEdit && args.Key == "Tab")

        {

            isTabPressed = true;

            leftFieldName = leftField;

            OrderIDValue = OrderID;

            await Grid.EndEditAsync();

        }

    }

 


Reference : https://blazor.syncfusion.com/documentation/datagrid/events#onactioncomplete


Please get back to us if you need further assistance.


Regards,

Renjith R


Attachment: ServerApp_f6cfa9c2.zip

Loader.
Up arrow icon