Blazor Grid: What are the possible ContextMenuItem targets

I want to add some custom context menu items to DataGrid.

I followed this docs: https://blazor.syncfusion.com/documentation/datagrid/context-menu/#custom-context-menu-items
What are the possible values for Target property?
new ContextMenuItemModel { Text = "Copy with headers", Target = ".e-content", Id = "copywithheader" }
I have tried .e-grid for example, but it does not work, so obviously it's not just any CSS selector.




1 Reply 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team November 12, 2020 01:23 PM UTC

Hi Liero, 

Greetings from Syncfusion. 

Query: Blazor Grid: What are the possible ContextMenuItem targets 

We have validated your query and the possible ContextMenuItem targets in the Grid are as follows. 

  • .e-content,
  • .e-header,
  • .e-pager.

 
<SfGrid @ref="DefaultGrid" DataSource="@Orders" AllowPaging="true"  
        ContextMenuItems="@(new List<ContextMenuItemModel>() { new ContextMenuItemModel  
                            { Text = "Content", Target = ".e-content", Id = "copywithheader" },  //it will open the item while clicking grid content area 
                            new ContextMenuItemModel  
                            { Text = "Header", Target = ".e-header", Id = "header" },  //it will open the item while clicking grid header area 
                            new ContextMenuItemModel  
                            { Text = "Pager", Target = ".e-pager", Id = "pager" }})">  //it will open the item while clicking grid pager area 
    <GridEvents ContextMenuItemClicked="OnContextMenuClick" TValue="Order"></GridEvents> 
    <GridPageSettings PageSize="8"></GridPageSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120" IsPrimaryKey="true"></GridColumn> 
        . . . 
    </GridColumns> 
</SfGrid> 

Please let us know if you have any concerns. 

Regards, 
Rahul 


Marked as answer
Loader.
Up arrow icon