Skip to content

Commit 85fe176

Browse files
984421: Updated the UG content and samples for Context-Menu in DataGrid
1 parent 1bb6b4e commit 85fe176

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

blazor/datagrid/context-menu.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -601,12 +601,12 @@ The **Copy** menu item is disabled for the **ShipCity** column and remains enabl
601601
}
602602

603603
private void OnContextMenuOpen(ContextMenuOpenEventArgs<OrderData> args)
604-
{
604+
{
605605
foreach (var item in args.ContextMenu.Items)
606606
{
607-
if (item.Text == "Copy")
607+
if (item.Text == "Copy" && args.Column.Field == nameof(OrderData.ShipCity))
608608
{
609-
item.Disabled = args.Column.Field == nameof(OrderData.ShipCity);
609+
item.Disabled = true;
610610
}
611611
}
612612
}
@@ -661,7 +661,7 @@ public class OrderData
661661
{% endhighlight %}
662662
{% endtabs %}
663663

664-
{% previewsample "https://blazorplayground.syncfusion.com/embed/VXLoWMXeysxsYYwF?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
664+
{% previewsample "https://blazorplayground.syncfusion.com/embed/rZrIiiZySUQfOieR?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
665665

666666
![Enable or Disable Context Menu Items](/images/context-menu/blazor-datagrid-enable-disable-context-menu-items.gif)
667667

@@ -708,9 +708,9 @@ The **Edit** menu item is hidden for the **CustomerID** column and remains visib
708708
{
709709
foreach (var item in args.ContextMenu.Items)
710710
{
711-
if (item.Text == "Edit Record")
711+
if (item.Text == "Edit Record" && args.Column.Field == nameof(OrderData.CustomerID))
712712
{
713-
item.Hidden = args.Column.Field == nameof(OrderData.CustomerID);
713+
item.Hidden = true;
714714
}
715715
}
716716
}
@@ -765,7 +765,7 @@ public class OrderData
765765
{% endhighlight %}
766766
{% endtabs %}
767767

768-
{% previewsample "https://blazorplayground.syncfusion.com/embed/VNLIZfXYKSwAiUpU?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
768+
{% previewsample "https://blazorplayground.syncfusion.com/embed/LtBIMWXIIKutSiPz?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
769769

770770
![Show or Hide Context Menu Items](/images/context-menu/blazor-datagrid-show-hide-context-menu-items.gif)
771771

0 commit comments

Comments
 (0)