Hi Kenney,
Thanks for the update.
Query: “ 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.”
We have analyzed your query and we suggest you to hide the Filter button in Menu Filter for that particular column using the below solution. OnActionBegin event will be triggered when certain action is initiated. So while opening the Filter dialog, OnActionBegin will be triggered with RequestType FilterBeforeOpen. Here we can to add custom style to document to hide the Filter button textbox for that particular column.
Refer the below code example
@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.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></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;
}
}
}
|
For your convenience we have prepared a sample using above code example which can be downloaded from below
Refer our UG documentation for your reference
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan