Multi rows update at once

Hello,
I need external input, to update selected rows columns to specified value.

Select rows from GRID=> DropDown select -> Update => selected rows specified column value should be updated. 

Is it even possible to update multi grid rows at once?

Thanks!

3 Replies 1 reply marked as answer

RR Rajapandi Ravi Syncfusion Team January 13, 2021 08:55 AM UTC

Hi Mantas, 

Greetings from syncfusion support 

We have analyzed your query and we understand you like to update the Grid selected record’s specific column value by using external input. So based on your query we have prepared a sample and achieved your requirement. Please refer the below code example, sample and video demo for more information. 

 
<ejs-dropdownlist id="Countries" select="select" dataSource="@ViewBag.gridData" width="200px" popupHeight="220px"> 
    <e-dropdownlist-fields text="CustomerID" value="CustomerID"></e-dropdownlist-fields> 
</ejs-dropdownlist> 
 
<script> 
    function select(args) { //select event of dropdown 
        var grid = document.getElementsByClassName('e-grid')[0].ej2_instances[0]; 
        var records = grid.getSelectedRecords(); 
        for (var i = 0; i < records.length; i++) { 
            grid.updateCell(grid.getRowIndexByPrimaryKey(records[i].OrderID), "CustomerID", args.itemData.CustomerID); 
        }                        //get the rowindex by using primary key   //specific column name     //value 
    } 
</script> 
 
<div> 
    <ejs-grid id="Grid" dataSource="@ViewBag.gridData" allowPaging="true" 
              toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel"})"> 
        <e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch" newRowPosition="Bottom"></e-grid-editsettings> 
        <e-grid-selectionsettings type="Multiple"></e-grid-selectionsettings> 
        <e-grid-columns> 
            .  .  .  .  .  .  
            .  .  .  .  .  . 
       </e-grid-columns> 
 
    </ejs-grid> 
</div> 
 



If we misunderstood anything wrongly, Please share the below details that will be helpful for us to provide better solution. 

1)       Share us your exact requirement scenario with detailed description. 

2)       If possible explain your requirement scenario with pictorial representation or video demonstration. 

Regards, 
Rajapandi R

Marked as answer

MP Mantas Parfionovas January 13, 2021 12:05 PM UTC

Hello,
So multi record edit is only available in Batch mode? In my situation I need to use dialog mode + be able to edit multirows. Any solution for that?


MS Manivel Sellamuthu Syncfusion Team January 14, 2021 06:45 AM UTC

Hi Mantas, 

Thanks for your update. 

Yes. Bulk add, editing , deleting is possible only in Batch Edit mode, Since the Batch edit mode stores the bulk CRUD operations in locally and update them in the local data source or server at once. 

While Inline and Dialog editing allows to modify(Add, Edit, Delete) one row at a time and saves them to the server or local data before modifying the next row. This is the default behavior. So it is not feasible to achieve your requirement. 

Regards, 
Manivel 


Loader.
Up arrow icon