|
[Command buttons]
@{
List<object> commands = new List<object>();
commands.Add(new { type = "CustomA", buttonOption = new { content="A" } });
commands.Add(new { type = "CustomB", buttonOption = new { content = "B" } });
}
[Grid]
@Html.EJS().Grid("FlatGrid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
. . . col.Field("Verified").HeaderText("Verified").DisplayAsCheckBox(true).EditType("booleanedit").Width("50").Add();
col.HeaderText("Manage Records").Width("160").Commands(commands).Add();
}).AllowPaging().RowDataBound("rowDataBound").EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true); }).Render()
[RowDataBound event]
<script>
function rowDataBound(args) {
//check the condition
if (args.data.Verified)
args.row.querySelector('[title="B"]').classList.add('e-hide')
else
args.row.querySelector('[title="A"]').classList.add('e-hide')
}
</script> |