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

Single click grid in batchmode

Is it possible to make edit a cell with single click or just writing when on focus  ?


1 Reply

RS Renjith Singh Rajendran Syncfusion Team November 26, 2019 09:23 AM UTC

Hi Armando, 

Thanks for contacting Syncfusion support. 

To edit a particular cell with Batch mode of editing in Grid, we suggest you to use the “EditCell” method to achieve single click editing in Grid. You can make the cell to editable in a single click, by enabling the “SelectionMode” as “Both” and bind the “CellSelected” event to Grid. And in that handler call the “EditCell” method based on the clicked cell. We have prepared a sample based on this requirement for your convenience, please download the sample form the link below, 

Please use the below codes, 
 
 
<EjsGrid @ref="GridInstance" AllowPaging="true" DataSource="@Orders" Toolbar="@(new List<string>() { "Cancel", "Update" })"> 
    <GridSelectionSettings Mode="Syncfusion.EJ2.Blazor.Grids.SelectionMode.Both" ></GridSelectionSettings>           @*Set the SelectionMode as Both*@ 
    <GridEditSettings AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings> 
    <GridEvents CellSelected="CellSelectHandler" TValue="OrdersDetails"></GridEvents>       @*Bind CellSelected event*@ 
    ... 
</EjsGrid> 
 
 
@code{ 
    public static EjsGrid<OrdersDetails> GridInstance { get; set; } 
    ... 
   public async void CellSelectHandler(CellSelectEventArgs<OrdersDetails> args) 
    { 
        var EditCellIndex = JsonConvert.DeserializeObject<Dictionary<string, object>>(args.CellIndex.ToString()); 
        var CurrentEditCellIndex = 0; 
        var CurrentEditRowIndex = 0; 
       foreach (var key in EditCellIndex)                  //Fetch the currently clicked cell details 
        { 
            if (key.Key == "rowIndex") 
            { 
                CurrentEditRowIndex = Convert.ToInt32(key.Value);                      //Fetch the row index 
            } 
            if (key.Key == "cellIndex") 
            { 
                CurrentEditCellIndex = Convert.ToInt32(key.Value);                    //Fetch the column index 
            } 
        } 
        var fied = await GridInstance.GetColumnFieldNames();                                  //Get the name of fields in Grid 
        GridInstance.EditCell(CurrentEditRowIndex, fied[CurrentEditCellIndex]);              //Call the “EditCell” method 
    } 
    ... 
} 

                                                          
Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Live Chat Icon For mobile
Up arrow icon