DxGridDataColumn.FilterRowOperatorType Property
Specifies the initial operator type used to create a filter condition based on the filter row value.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v23.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(GridFilterRowOperatorType.Default)]
[Parameter]
public GridFilterRowOperatorType FilterRowOperatorType { get; set; }
Property Value
Type | Default | Description |
---|---|---|
GridFilterRowOperatorType | Default | A GridFilterRowOperatorType enumeration value. |
Available values:
Name | Description |
---|---|
Default | Uses the Contains operator type for columns bound to the String data type; Equals in other cases. |
Equal | Selects records that are equal to the entered value. |
NotEqual | Selects records that are not equal to the entered value. |
StartsWith | Selects records that start with the entered string. |
EndsWith | Selects records that end with the entered string. |
Contains | Selects records that contain the entered string. |
Less | Selects records that are less than the entered value. String values are compared based on their alphabetical order. |
LessOrEqual | Selects records that are less than the entered value or equal to it. String values are compared based on their alphabetical order. |
Greater | Selects records that are greater than the entered value. String values are compared based on their alphabetical order. |
GreaterOrEqual | Selects records that are greater than the entered value or equal to it. String values are compared based on their alphabetical order. |
Remarks
Enable the ShowFilterRow option to activate a row that allows users to filter Grid data. The Grid component generates and configures cell editors for filter row cells based on associated column data types. When a user types into an editor, the Grid creates a filter condition based on the editor value and applies this condition to the corresponding column.
The Grid chooses an operator type automatically: Contains for columns bound to the String data type; Equals in other cases. Use the FilterRowOperatorType
property to change the operator type.
When you use the FilterRowValue property to specify the initial editor value, you should also specify the FilterRowOperatorType
property explicitly.
You can handle the FilterRowOperatorTypeChanged event to respond to operator type changes.
Note
The filter menu and filter row use the same set of filter criteria for fields and may affect each other. For example, when a user types a value in the filter row and then picks a value in a filter menu of the same column, the Grid component applies different criteria. When a user enters a value in the filter row again, the Grid applies the new operator set by the filter menu. You can implement the UI to change the filter row’s operator type to make sure which filter criteria is currently applied. Refer to the following example for more information: https://github.com/DevExpress-Examples/blazor-dxgrid-filter-operator-selector.
@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable
<DxGrid Data="@Data"
ShowFilterRow="true">
<Columns>
<DxGridDataColumn FieldName="OrderId" Caption="Order ID" DisplayFormat="d"/>
<DxGridDataColumn FieldName="OrderDate" DisplayFormat="d" />
<DxGridDataColumn FieldName="ProductName"
FilterRowValue='"Queso"'
FilterRowOperatorType="GridFilterRowOperatorType.Contains" />
<DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c2" />
<DxGridDataColumn FieldName="Shipped" UnboundType="GridUnboundColumnType.Boolean"
UnboundExpression="[ShippedDate] <> Null" />
</Columns>
</DxGrid>
@code {
object Data { get; set; }
NorthwindContext Northwind { get; set; }
protected override void OnInitialized() {
Northwind = NorthwindContextFactory.CreateDbContext();
Data = Northwind.Invoices
.ToList();
}
public void Dispose() {
Northwind?.Dispose();
}
}
For more information about the filter row, see the following topic: Filter Row in Blazor Grid.