Set focus and edit mode on a cell of the grid

Hi,

At initialisation of the grid, i want to set the focus on a particular cell in my grid and force edit mode on the cell.
I want to select the cell with its name, not a number rank since user can change cells position with show-column-chooser.

I see several samples in the forum for Windows Form, WPF, and so on but none in ASP.NET Core.

Can you help me please ?

Thx by advance,
Fred.

1 Reply

RS Renjith Singh Rajendran Syncfusion Team April 27, 2018 09:57 AM UTC

Hi Fred, 

Thanks for contacting Syncfusion support. 

We suggest you use the “editCell” method of Grid inside the “dataBound” event Grid. The editCell method will edit a particular cell based on the column field name and the row index. Here we are using the “currentViewData” property of Grid to check for the values in Grid and based on the values we will be moving the cell to editable state. Please refer the code example and sample below, 

<ejs-grid id="Grid" dataSource="ViewBag.datasource" dataBound="databound" allowPaging="true"> 
    <e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch"></e-grid-editsettings> 
    <e-grid-columns> 
        <e-grid-column field="OrderID" headerText="Order ID" textAlign="Right" width="120"></e-grid-column> 
        <e-grid-column field="Freight" headerText="Freight" isPrimaryKey="true" format="C2" width="120"></e-grid-column> 
        ... 
    </e-grid-columns> 
</ejs-grid> 
 
<script type="text/javascript"> 
    function databound(args) { 
        for (var i = 0; i < this.currentViewData.length; i++) {   //Iterates each row in the Grid 
            if (this.currentViewData[i].OrderID == 10001) {       //Checks for value 
                this.editModule.editCell(i, "OrderID");           //Select and edit a particular cell based on the column field name 
            } 
        } 
    } 
</script> 

We have also prepared a sample, in which a particular cell will be displayed as edited at initial Grid rendering based on the value of the cell in Grid. Please download the sample from the link below, 

Documentations :  

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Up arrow icon