[CSHTML]
<body>
@(Html.EJ().TreeGrid("TreeGridContainer")
//..
.ClientSideEvents(ce =>
{
ce.BeginEdit("BeginEdit");
})
.EditSettings(es =>
{
es.AllowEditing(true);
})
.Datasource(ViewBag.datasource)
)
@(Html.EJ().ScriptManager())
<script type="text/javascript">
//Event trigger at the cell edit
function BeginEdit(args) {
alert("Event trigger when the user double clicks the record");
args.cancel = true; // Canceling default edit operation.
}
</script>
</body> |
[CSHTML]
<body>
@(Html.EJ().TreeGrid("TreeGridContainer")
//..
.ContextMenuSettings(cs =>
{
cs.ShowContextMenu(true);
})
.ContextMenuOpen("ContextMenuOpen") //Event trigger while open context menu.
.Datasource(ViewBag.datasource)
)
@(Html.EJ().ScriptManager())
<script type="text/javascript">
//Event trigger while open context menu.
function ContextMenuOpen(args) {
args.contextMenuItems = [];
var data = args.item;
if (data) {
args.contextMenuItems.push({
headerText: "Edit",
menuId: "edit",
eventHandler: customMenuAddHandler,
iconClass: "e-edit",
disable: false
});
}
}
function customMenuAddHandler() {
alert("Show dialog while click edit context menu");
}
</script>
</body> |