Hi, I'd like to remove/hide the 'Filter' button for ONLY one column in my data grid. For all other columns, I want to keep the 'Filter' button.
For example:
BEFORE:
AFTER:
Question:
How do I remove the 'Filter' button for ONLY one column?
Thank you
|
@using Syncfusion.Blazor.Grids
<SfGrid DataSource="@Orders" AllowPaging="true" AllowFiltering="true">
<GridEvents OnActionBegin="OnActionBegin" TValue="Order"></GridEvents>
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
@if (CanAdd)
{
<style>
.e-grid .e-filter-popup .e-footer-content .e-flmenu-okbtn {
display: none;
}
</style>
}
@code{
public List<Order> Orders { get; set; }
public bool CanAdd { get; set; }
public void OnActionBegin(ActionEventArgs<Order> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.FilterBeforeOpen)
{
if (Args.ColumnName == "CustomerID")
{
CanAdd = true;
}
else
{
CanAdd = false;
}
}
}
|