Skip to main content
All docs
V24.2

GridFilterMenuDataItem Class

Defines an item in the column filter menu.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public class GridFilterMenuDataItem :
    GridFilterMenuDataItemBase

Remarks

The GridFilterMenuDataItem class implements the functionality of an individual item in the column filter menu. Handle the CustomizeFilterMenu event to access and customize the list of items (DataItems).

<DxGrid Data="@customers" 
        HeaderFilterButtonDisplayMode="GridHeaderFilterButtonDisplayMode.Always"
        CustomizeFilterMenu="OnCustomizeFilterMenu">
    <Columns>
        <DxGridDataColumn FieldName="ContactName" />
        <DxGridDataColumn FieldName="Company" />
        <DxGridDataColumn FieldName="Country" />
    </Columns>
</DxGrid>

@code {
    DateTime data { get; set; }
    private Customer[]? customers;
    protected override async Task OnInitializedAsync() {
        customers = await CustomerData.GetData();
    }
    void OnCustomizeFilterMenu (GridCustomizeFilterMenuEventArgs e) {
        if (e.DataColumn.FieldName == "ContactName") {
            e.DataItems.ForEach(di => {
                int? CustomerID = customers.Where(c => 
                    c.ContactName == di.Value.ToString()).FirstOrDefault()?.ID;
                di.DisplayText = di.DisplayText + " (ID " + CustomerID + ")";
            });
        }
    }
}

Blazor Grid - Customized filter menu items

Inheritance

Object
DevExpress.Blazor.Internal.GridFilterMenuDataItemBase
GridFilterMenuDataItem
See Also