Select the cell by pressing enter.

Hi, I have problems selecting a cell grid.MoveCurrentCell. This is a part of the code:

using Syncfusion.UI.Xaml.Grid.ScrollAxis;

using RowColumnIndex = Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex;


public static void GoToNextEditableCell(SfDataGrid grid)

{

    var manager = grid.SelectionController.CurrentCellManager;

    if (manager == null || !manager.HasCurrentCell)

        return;


    manager.EndEdit();


    var current = manager.CurrentRowColumnIndex;

    int rowIndex = current.RowIndex;

    int colIndex = current.ColumnIndex;

    RowColumnIndex rowColumnIndex1 = new RowColumnIndex();


    // Find next visible editable column

    for (int c = colIndex + 1; c < grid.Columns.Count; c++)

    {

        var col = grid.Columns[c];

        if (!col.IsHidden && col.AllowEditing)

        {

            var nextCell = new RowColumnIndex(rowIndex, c);

            // Here, instead of jumping to the next column in the same row,

            // it jumps to the next column in the next row.

            grid.MoveCurrentCell(nextCell,false);

            grid.SelectionController.CurrentCellManager.BeginEdit();


             //Can I use this instead of the above instruction?

            //manager.BeginEdit();

            return;

        }

    }


    // If there is no next editable, we stay in the same cell

    var sameCell = new RowColumnIndex(rowIndex, colIndex);

    grid.MoveCurrentCell(sameCell, false);

}


Where is my mistake? Greetings




3 Replies

MS Malini Selvarasu Syncfusion Team May 20, 2025 02:19 PM UTC

Hi Hugo Ruiz,

We noticed that you had created a ticket for the same issue under your account in our ticketing system, please follow that for further updates.

Regards,
Malini Selvarasu


HR Hugo Ruiz May 20, 2025 03:20 PM UTC

Hi, sorry for the confusion. This is my first time using SyncFusion. I need help with something so trivial, and I haven't been able to find a solution even with ChatGPT. I thought there were two types of forums, and I'm here to see where I can get a quick answer. Regards.


MS Malini Selvarasu Syncfusion Team May 21, 2025 03:35 PM UTC

Hi Hugo Ruiz,

We are glad that the solution provided in the ticket meets your requirements. If you need further assistance, please feel free to reach out. We are happy to help you.

Regards,
Malini Selvarasu

Loader.
Up arrow icon