|
@Html.EJS().Grid("Grid")
.DataSource((IEnumerable<object>)
ViewBag.dataSource)
.BatchAdd("batchAdd")
.RowSelected("rowSelected")
.Render()
<script>
function batchAdd(args) {
}
function rowSelected(args) {
}
</script>
|
|
<div>
@Html.EJS().Grid("Grid").DataSource(dataManger =>
{
dataManger.Url("/Home/UrlDatasource").BatchUrl("/Home/BatchUpdate").Adaptor("UrlAdaptor");
}).AllowPaging().Columns(col =>
{
. . . . . . .
}).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).BeforeBatchAdd("batchAdd").RowSelected("selected").SelectionSettings(select => select.Mode(Syncfusion.EJ2.Grids.SelectionMode.Row).Type(Syncfusion.EJ2.Grids.SelectionType.Single)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Batch); }).Render()
</div>
<script>
var obj;
function selected(args) {
obj = this.getSelectedRecords()[0]; //save the selected records here
}
function batchAdd(args) {
if (obj) {
args.defaultData.EmployeeID = obj.EmployeeID; //retrieve the saved record value here and set into the default data
args.defaultData.CustomerID = obj.CustomerID;
}
}
</script>
|