You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blazor/datagrid/filtering.md
+10-28Lines changed: 10 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,6 @@ Filtering is a key feature in the Syncfusion<sup style="font-size:70%">®</su
13
13
14
14
To enable filtering in the Grid, set the [AllowFiltering](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_AllowFiltering) property to **true**. Once enabled, configure filtering behavior and appearance using the [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings) property.
15
15
16
-
The following example demonstrates the default filtering feature of the Grid:
17
-
18
16
{% tabs %}
19
17
{% highlight razor tabtitle="Index.razor" %}
20
18
@@ -94,9 +92,7 @@ public class OrderData
94
92
95
93
## Initial filter
96
94
97
-
To apply an initial filter in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid, define the filter criteria using the Predicate object within the [Columns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridFilterSettings.html#Syncfusion_Blazor_Grids_GridFilterSettings_Columns) property of [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings). The Predicate object represents the filtering condition and includes properties such as **field**, **operator**, and **value**.
98
-
99
-
The following example demonstrates how to configure the initial filter using the Predicate object:
95
+
To apply an initial filter in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid, define the filter criteria using the **Predicate** object within the [Columns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridFilterSettings.html#Syncfusion_Blazor_Grids_GridFilterSettings_Columns) property of [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings). The **Predicate** object represents the filtering condition and includes properties such as **Field**, **Operator**, and **Value**.
100
96
101
97
{% tabs %}
102
98
{% highlight razor tabtitle="Index.razor" %}
@@ -185,8 +181,6 @@ In the Syncfusion<sup style="font-size:70%">®</sup> Blazor DataGrid, an init
185
181
186
182
To apply an initial filter with multiple values for the same column, define the filter [Predicate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridFilterColumn.html#Syncfusion_Blazor_Grids_GridFilterColumn_Predicate) object within the [Columns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridFilterSettings.html#Syncfusion_Blazor_Grids_GridFilterSettings_Columns) property of [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings).
187
183
188
-
The following example demonstrates how to configure an initial filter with multiple values for the **CustomerID** column using the `Columns` property of `GridFilterSettings` and Predicate:
189
-
190
184
{% tabs %}
191
185
{% highlight razor tabtitle="Index.razor" %}
192
186
@@ -310,8 +304,6 @@ In the Syncfusion<sup style="font-size:70%">®</sup> Blazor DataGrid, an init
310
304
311
305
To apply an initial filter with multiple values for different columns, define the filter [Predicate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridFilterColumn.html#Syncfusion_Blazor_Grids_GridFilterColumn_Predicate) object within the [Columns](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridFilterSettings.html#Syncfusion_Blazor_Grids_GridFilterSettings_Columns) property of [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings).
312
306
313
-
The following example demonstrates how to configure an initial filter with multiple values for the **Order ID** and **Customer ID** columns using the `Columns` property of `GridFilterSettings` and Predicate:
314
-
315
307
{% tabs %}
316
308
{% highlight razor tabtitle="Index.razor" %}
317
309
@@ -497,7 +489,7 @@ ab* | Matches values that contain “a”, followed by any characters, then “b
497
489
498
490
### Like filtering
499
491
500
-
The Like filter processes single search patterns using the <b>%</b> symbol to retrieve values that match the defined criteria. The following Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid features support Like filtering on string-type columns:
492
+
The **Like** filter processes single search patterns using the <b>%</b> symbol to retrieve values that match the defined criteria. The following Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid features support Like filtering on string-type columns:
501
493
502
494
* Filter Menu
503
495
* Filter Bar using the [Operator](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.FilterSettings.html#Syncfusion_Blazor_Grids_FilterSettings_Operator) property within the [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings) configuration
@@ -517,8 +509,6 @@ The Like filter processes single search patterns using the <b>%</b> symbol to re
517
509
518
510
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid provides the flexibility to enable or disable case sensitivity during filtering. This feature allows control over whether filtering operations should consider character casing. Case sensitivity can be configured using the [EnableCaseSensitivity](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridFilterSettings.html#Syncfusion_Blazor_Grids_GridFilterSettings_EnableCaseSensitivity) property of [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings)configuration.
519
511
520
-
The following example demonstrates how to enable or disable case sensitivity during filtering:
521
-
522
512
{% tabs %}
523
513
{% highlight razor tabtitle="Index.razor" %}
524
514
@@ -779,8 +769,6 @@ public class OrderData
779
769
780
770
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid provides flexibility to modify the default filter operator for individual columns. By default, the filter operator is set to **StartsWith** for string-type columns, and **Equal** for numerical and boolean-type columns. In scenarios where a different operator better suits the nature of the data, the default can be customized using the [Operator](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.FilterSettings.html#Syncfusion_Blazor_Grids_FilterSettings_Operator) property within the [GridFilterSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterSettings) configuration.
781
771
782
-
The following example demonstrates how to change the default filter operator for a column:
## Filter Blazor DataGrid programmatically with single and multiple values using method
929
+
## Filter via programmatically
942
930
943
931
Programmatic filtering in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid enables applying filters to specific columns without relying on UI interactions. This approach supports both single and multiple filter values.
944
932
945
933
Filtering can be performed using the [FilterByColumnAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterByColumnAsync_System_String_System_String_System_Object_System_String_System_Nullable_System_Boolean__System_Nullable_System_Boolean__System_Object_System_Object_System_String_) method of the Grid.
946
934
947
-
The following example demonstrates how to programmatically filter the Grid using single and multiple values for the **OrderID** and **CustomerID** columns. This is accomplished by invoking the `FilterByColumnAsync` method within an external button click handler:
948
-
949
935
{% tabs %}
950
936
{% highlight razor tabtitle="Index.razor" %}
951
937
@@ -1042,11 +1028,11 @@ public class OrderData
1042
1028
1043
1029
Retrieving filtered records in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid is essential when working with data that matches the currently applied filters. This can be accomplished using available methods and event properties in the Grid.
1044
1030
1045
-
**1. Using the GetFilteredRecordsAsync() method**
1031
+
**Fetch filtered Records with GetFilteredRecordsAsync**
1046
1032
1047
-
The [GetFilteredRecordsAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_GetFilteredRecordsAsync_System_Boolean_) method returns an array of records that match the currently applied filters.
1033
+
**Local Data**
1048
1034
1049
-
The following example demonstrates how to retrieve filtered data using the `GetFilteredRecordsAsync` method:
1035
+
The [GetFilteredRecordsAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_GetFilteredRecordsAsync_System_Boolean_) method returns a collection of records that match the currently applied filters.
**2. Using the GetFilteredRecordsAsync() method with remote data**
1187
+
**Remote Data**
1202
1188
1203
1189
When using a remote data source, the [GetFilteredRecordsAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_GetFilteredRecordsAsync_System_Boolean_) method returns the filtered records as objects. These objects must be deserialized to access the filtered data.
1204
1190
@@ -1304,7 +1290,7 @@ When using a remote data source, the [GetFilteredRecordsAsync](https://help.sync
**3. Using properties in the FilteredEventArgs object**
1293
+
**Accessing filter details via FilteredEventArgs Properties**
1308
1294
1309
1295
Filtered record details can also be accessed through the [Filtered](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridEvents-1.html#Syncfusion_Blazor_Grids_GridEvents_1_Filtered) event handler using the following properties:
1310
1296
@@ -1319,12 +1305,10 @@ public async Task FilteredHandler(FilteredEventArgs args)
1319
1305
}
1320
1306
```
1321
1307
1322
-
## Clear filtering using methods
1308
+
## Clear filter via programmatically
1323
1309
1324
1310
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid provides the [ClearFilteringAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_ClearFilteringAsync) method to remove applied filters and reset the Grid to its original state.
1325
1311
1326
-
The following example demonstrates how to clear filtering in the Grid using the `ClearFilteringAsync` method:
1327
-
1328
1312
{% tabs %}
1329
1313
{% highlight razor tabtitle="Index.razor" %}
1330
1314
@@ -1414,8 +1398,6 @@ Filtering events provide customization options for the Syncfusion<sup style="fon
1414
1398
1415
1399
To implement filtering events, use the available [Filtering](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridEvents-1.html#Syncfusion_Blazor_Grids_GridEvents_1_Filtering) and [Filtered](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridEvents-1.html#Syncfusion_Blazor_Grids_GridEvents_1_Filtered) events. These events allow intervention in the filtering process and support customization.
1416
1400
1417
-
The following example demonstrates how to prevent filtering for the **ShipCity** column during the `Filtering` event:
1418
-
1419
1401
{% tabs %}
1420
1402
{% highlight razor tabtitle="Index.razor" %}
1421
1403
@@ -1527,7 +1509,7 @@ public class OrderData
1527
1509
1528
1510
Enum-type data can be filtered in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid using the Filter Template feature.
1529
1511
1530
-
In the following example, the [SfDropDownList](https://blazor.syncfusion.com/documentation/dropdown-list/getting-started-with-web-app) component is rendered within the [FilterTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_FilterTemplate) of the Type column. The enumerated list is bound to the column, and filtering is applied dynamically using the [ValueChange](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.DropDownListEvents-2.html#Syncfusion_Blazor_DropDowns_DropDownListEvents_2_ValueChange) event of the `SfDropDownList`. Within this event, the [FilterByColumnAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterByColumnAsync_System_String_System_String_System_Object_System_String_System_Nullable_System_Boolean__System_Nullable_System_Boolean__System_Object_System_Object_System_String_) method is used to apply filtering to the Type column.
1512
+
In the following example, the [SfDropDownList](https://blazor.syncfusion.com/documentation/dropdown-list/getting-started-with-web-app) component is rendered within the [FilterTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_FilterTemplate) of the **Type** column. The enumerated list is bound to the column, and filtering is applied dynamically using the [ValueChange](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.DropDownListEvents-2.html#Syncfusion_Blazor_DropDowns_DropDownListEvents_2_ValueChange) event of the `SfDropDownList`. Within this event, the [FilterByColumnAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_FilterByColumnAsync_System_String_System_String_System_Object_System_String_System_Nullable_System_Boolean__System_Nullable_System_Boolean__System_Object_System_Object_System_String_) method is used to apply filtering to the **Type** column.
0 commit comments