|
<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>
|