DxGridDataColumn.FilterMode Property
Specifies whether grid data is filtered by value or display text.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(GridColumnFilterMode.Value)]
[Parameter]
public GridColumnFilterMode FilterMode { get; set; }
Property Value
Type | Default | Description |
---|---|---|
GridColumnFilterMode | Value | The filter mode. |
Available values:
Name | Description |
---|---|
Value | Filters data by value. |
DisplayText | Filters data by display text. |
Remarks
The FilterMode
property specifies whether grid data is filtered by value or display text.
Filter Data By Value (Default Behavior)
When the FilterMode
property is set to Value
, the grid filters rows by cell values.
<DxGrid Data="@Data" CustomizeCellDisplayText="Grid_CustomizeCellDisplayText"
ShowFilterRow="true" PageSize="7">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D" />
<DxGridDataColumn FieldName="CloudCover" />
<DxGridDataColumn FieldName="TemperatureC" TextAlignment="GridTextAlignment.Left" Caption="Forecast"
FilterMode="GridColumnFilterMode.Value" />
</Columns>
</DxGrid>
void Grid_CustomizeCellDisplayText(GridCustomizeCellDisplayTextEventArgs e) {
if(e.FieldName == "TemperatureC") {
int val = Convert.ToInt32(e.Value);
if(val < 15)
e.DisplayText = "Cold";
else if(val < 25)
e.DisplayText = "Warm";
else
e.DisplayText = "Hot";
}
}
Filter Data By Display Text
When the FilterMode
property is set to DisplayText
, the grid filters rows by display text. This scenario can be useful when you specify custom display text for cells (see the DisplayFormat property and CustomizeCellDisplayText event descriptions).
<DxGrid Data="@Data" CustomizeCellDisplayText="Grid_CustomizeCellDisplayText"
ShowFilterRow="true" PageSize="7">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D"
FilterMode="GridColumnFilterMode.DisplayText" />
<DxGridDataColumn FieldName="CloudCover" />
<DxGridDataColumn FieldName="TemperatureC" TextAlignment="GridTextAlignment.Left" Caption="Forecast"
FilterMode="GridColumnFilterMode.DisplayText" />
</Columns>
</DxGrid>
void Grid_CustomizeCellDisplayText(GridCustomizeCellDisplayTextEventArgs e) {
if(e.FieldName == "TemperatureC") {
int val = Convert.ToInt32(e.Value);
if(val < 15)
e.DisplayText = "Cold";
else if(val < 25)
e.DisplayText = "Warm";
else
e.DisplayText = "Hot";
}
}
For more information about filter row, see the following topic: Filter Row in Blazor Grid.
Limitations
The Grid does not support filtering by display text in the following cases:
- Blazor Grid is bound to a Server Mode data source or GridDevExtremeDataSource.
- The column’s filter menu is hierarchical.