@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowSorting()
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
-----------------------------
.Columns(col =>
{
---------------------------
})
.ClientSideEvents(eve => eve.ActionBegin("begin"))
)
<script>
function begin(args) {
if (args.requestType == "save") {
$("#FlatGrid").ejWaitingPopup("show");
var findDuplicate = false;
var Description = this.model.columns[1].field;
for (var i = 0; i < args.model.currentViewData.length; i++) {
if (args.model.currentViewData[i].CustomerID == args.data[Description]) {
args.cancel = true;
alert("Not working");
findDuplicate = true;
break;
}
}
if (findDuplicate) {
return;
}
}
}
</script>
|