Hi support team,
I have 2 points need to support:
1.I have to create some custom context menus when users right-click on the row of treeview, but there is a condition for those, the context menu will be disabled/enable base on condition. For example, as image below, the "context menu 1" is disabled
How could I do it? Could you give me some examples of it?
You can directly adjust on this demo https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp3882912022
2. How do I config the context menu just available on child item of treeview, not in parent item. For example the planing parent item below should not have context menu. Only the child item (Plan budget, Allocate resources, etc.)
Regards,
Tho
|
public void OnContextMenuOpen(ContextMenuOpenEventArgs<HiCoSwc> args)
{
var Keys = TreeData.GroupBy(rec => rec.ParentID).Select(rec => rec.Key.ToString()).ToList(); //To fetch parentID for all records
if (Keys.Contains(args.RowInfo.RowData.ID.ToString())) //Checking whether current opted row for opening contextmenu is present and has value
{
args.Cancel = true;
}
else
{
if (args.RowInfo.RowData.Name == "Child task 1")
{
foreach (var item in args.ContextMenuObj.Items)
{
if (item.Id == "copy")
{
item.Disabled = true; //To disable a context menu item
}
}
}
}
} |
Regards,
Jagadesh Ram