How to delete row when I add multiple rows in batch mode?

Hi, 

How I Can delete specific row when I'm adding multiple rows in batch mode?

Thanks Very Much


1 Reply

RR Rajapandi Ravi Syncfusion Team December 30, 2021 11:39 AM UTC

Hi Ahmed, 

Greetings from Syncfusion support 

From your update, we could see that you like to delete the adding record in batch mode. Based on your query we have prepared a sample and we suggest you use the below way to achieve your requirement. Please refer the below code example and sample for more information. 

 
    <button id="store" onclick="deleteRecord()">Delete Adding Record</button> 
    <ejs-grid id="Grid" dataSource="ViewBag.dataSource" allowPaging="true" toolbar="@(new List<string>() { "Add","Delete","Update","Cancel" })"> 
        <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch"></e-grid-editSettings> 
        <e-grid-columns> 
     .  .  .  .  .  .  .  .  .  .  
     .  .  .  .  .  .  .  .  .  . 
        </e-grid-columns> 
    </ejs-grid> 
</div> 
 
<script> 
    function deleteRecord() { 
        var grid = document.getElementById('Grid').ej2_instances[0]; //grid instance 
           //we have delete the 1st row 
        var getUid = grid.getRowsObject()[0].uid; //get uid from RowsObject 
        var rowElement = grid.getRowElementByUID(getUid); //get the tr element by using uid 
        grid.deleteRow(rowElement); //delete the adding record by passing the tr element. 
    } 
</script> 
 




Regards, 
Rajapandi R 
 


Loader.
Up arrow icon