Hello,
I'm using a Blazor server version.
I want on right mouse click (open context menu) to select current row. Or how that can be possible. On OnRowClick we have only MouseEvntArgs.
Because I have a issue when user select first row on datagrid, and then call a context menu on some other row (the selected row is still active) and do a delete. Delete will delete selected row what is wrong.
1 Like
enchev
November 1, 2021, 8:14am
2
Hi @mmitrovic ,
At the moment this is not supported. We will do our best to provide a way for row/cell context menus in some of our future releases.
Hi @enchev ,
This is a fast solution, I really appreciate that.
I can see your changes and that should work, but I don't see the changes when I pull last NuGet version (3.11.11). Can you help me with that?
enchev
November 1, 2021, 7:14pm
5
These changes are still unreleased, it will be later this week.
1 Like
enchev
November 4, 2021, 6:49am
6
Works as expected, many thanks!
How is it possible for now?
enchev
April 16, 2022, 6:48am
9
Hey @Duy_Kh_ng ,
Check the demo I’ve posted. The code is here:
{
selectedEmployees = null;
}
protected override void OnInitialized()
{
employees = dbContext.Employees;
selectedEmployees = employees.Take(1).ToList();
}
void OnCellContextMenu(DataGridCellMouseEventArgs<Employee> args)
{
selectedEmployees = new List<Employee>() { args.Data };
ContextMenuService.Open(args,
new List<ContextMenuItem> {
new ContextMenuItem(){ Text = "Context menu item 1", Value = 1 },
new ContextMenuItem(){ Text = "Context menu item 2", Value = 2 },
new ContextMenuItem(){ Text = "Context menu item 3", Value = 3 },
},
(e) => {
1 Like
Thank you, I got it.
So, another case, how about Tree component? I have same issue.