Hi Dan,
Thanks for contacting Syncfusion support.
We suggest you to bind the “OnActionComplete” event to Grid, and in the event handler based on the “RequestType” and “ColumnName” modify the value of ContextMenuItems property of Grid. We have prepared a sample based on this requirement, please download the sample form the link below,
Please use the code below,
<EjsGrid TValue="Order" ID="Grid" AllowSorting="true" AllowFiltering="true" AllowPaging="true" ContextMenuItems="@ContextItems">
<GridEvents OnActionComplete="OnActionComplete" TValue="Order"></GridEvents>
<EjsDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></EjsDataManager>
...
</EjsGrid>
@code{
public static List<Order> Orders { get; set; }
public List<object> ContextItems = new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "LastPage", "NextPage"};
...
public void OnActionComplete(ActionEventArgs<Order> args)
{
if(args.RequestType.ToString() == "Sorting")
{
if(args.ColumnName != null)
{
ContextItems = new List<object>() { }; //Empty the context items if the column is sorted, so that context menu wont open
}
else
{
ContextItems = new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "LastPage", "NextPage"};
}
}
}
...
}
|
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran.