I have a TreeList and a connected ContextMenu. The context menu shows correctly the first time only when clicking on a TreeList row. After that however, no matter where I right-click on the page, the context menu is displayed.
@(Html.Kendo().ContextMenu() .Name("orgtreemenu") .Target("#OrganizationTreeMaintenance") .Orientation(ContextMenuOrientation.Vertical) .Filter(".k-grid-content table tbody tr[role='row']") .Events(e => e .Open("orgContextMenuOpen") .Select("orgTreemenuSelect") ) .Items(items => { items.Add() .Text("Add Organization") .HtmlAttributes(new { @id = "addorgaction" }) .Enabled(true); items.Add() .Text("Edit Name") .HtmlAttributes(new { @id = "editorgnameaction" }) .Enabled(true); items.Add() .Text("Delete Organization") .HtmlAttributes(new { @id = "deleteorgaction" }) .Enabled(true); items.Add() .Text("Move Organization") .HtmlAttributes(new { @id = "moveorgaction" }) .Enabled(false); }))
@(Html.Kendo().TreeList<UserStatViewModel>()
.Name("OrganizationTreeMaintenance")
.Columns(columns =>
{
columns.Add().Field(e => e.OrganizationName).Width(300);
columns.Add().Field(e => e.OrganizationId).Hidden(true);
columns.Add().Field(e => e.TotalUserCount).Title("Users");
columns.Add().Field(e => e.TotalDeviceCount).Title("Devices");
columns.Add().Field(e => e.LicensedUserCount).Title("Licenses");
})
.Sortable()
.HtmlAttributes(new { style = "height:500px;" })
.Events(e => e
.DataBound("onDataBoundLicenseTree"))
.DataSource(dataSource => dataSource
.Read(read => read.Action("GetOrgLicenseDetails", "home"))
.ServerOperation(false)
.Model(m =>
{
m.Id(f => f.OrganizationId);
m.ParentId(f => f.ParentOrgId).DefaultValue(0);
// m.Expanded(true);
m.Field(f => f.OrganizationName);
m.Field(f => f.TotalDeviceCount);
m.Field(f => f.ParentOrgId);
})
))
I have tried modifying the Filter on the context menu to no avail. Hoping someone can see something obvious.
Thanks and regards,
Eric Katz
Ok, this turned out to be user error. There was a line of code in the open handler that was creating a duplicate context menu instead of just using