@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.AllowPaging()
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.Columns(col =>
{
---------------------------
})
.ClientSideEvents(eve => { eve.BeginEdit("beginEdit"); })
)
<script>
function beginEdit(args) {
if(args.requestType == "beginedit") {
var data = args.row.find("input");
for (var i = 0 ; i < data.length ; i++) {
if (data[i].name == "EmployeeID" && parseInt($(data[i]).attr("value")) == 5) {
$(data[i]).addClass("e-disable").attr("disabled","disabled");
}
}
} }
</script>
|