Skip to content

Commit 1003f56

Browse files
991627: Updated the UG content and samples for Filtering in Blazor DataGrid
1 parent cc73829 commit 1003f56

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

blazor/datagrid/filtering.md

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Filtering is a key feature in the Syncfusion<sup style="font-size:70%">&reg;</su
1313

1414
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.
1515

16-
The following example demonstrates the default filtering feature of the Grid:
17-
1816
{% tabs %}
1917
{% highlight razor tabtitle="Index.razor" %}
2018

@@ -94,9 +92,7 @@ public class OrderData
9492
9593
## Initial filter
9694

97-
To apply an initial filter in the Syncfusion<sup style="font-size:70%">&reg;</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<sup style="font-size:70%">&reg;</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**.
10096

10197
{% tabs %}
10298
{% highlight razor tabtitle="Index.razor" %}
@@ -185,8 +181,6 @@ In the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid, an init
185181

186182
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).
187183

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-
190184
{% tabs %}
191185
{% highlight razor tabtitle="Index.razor" %}
192186

@@ -310,8 +304,6 @@ In the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid, an init
310304

311305
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).
312306

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-
315307
{% tabs %}
316308
{% highlight razor tabtitle="Index.razor" %}
317309

@@ -497,7 +489,7 @@ ab* | Matches values that contain “a”, followed by any characters, then “b
497489

498490
### Like filtering
499491

500-
The Like filter processes single search patterns using the <b>%</b> symbol to retrieve values that match the defined criteria. The following Syncfusion<sup style="font-size:70%">&reg;</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<sup style="font-size:70%">&reg;</sup> Blazor DataGrid features support Like filtering on string-type columns:
501493

502494
* Filter Menu
503495
* 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
517509

518510
The Syncfusion<sup style="font-size:70%">&reg;</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.
519511

520-
The following example demonstrates how to enable or disable case sensitivity during filtering:
521-
522512
{% tabs %}
523513
{% highlight razor tabtitle="Index.razor" %}
524514

@@ -779,8 +769,6 @@ public class OrderData
779769

780770
The Syncfusion<sup style="font-size:70%">&reg;</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.
781771

782-
The following example demonstrates how to change the default filter operator for a column:
783-
784772
{% tabs %}
785773
{% highlight razor tabtitle="Index.razor" %}
786774

@@ -938,14 +926,12 @@ public class OrderData
938926

939927
{% previewsample "https://blazorplayground.syncfusion.com/embed/rtLTXCAsUitWDKfU?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
940928

941-
## Filter Blazor DataGrid programmatically with single and multiple values using method
929+
## Filter via programmatically
942930

943931
Programmatic filtering in the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid enables applying filters to specific columns without relying on UI interactions. This approach supports both single and multiple filter values.
944932

945933
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.
946934

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-
949935
{% tabs %}
950936
{% highlight razor tabtitle="Index.razor" %}
951937

@@ -1042,11 +1028,11 @@ public class OrderData
10421028

10431029
Retrieving filtered records in the Syncfusion<sup style="font-size:70%">&reg;</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.
10441030

1045-
**1. Using the GetFilteredRecordsAsync() method**
1031+
**Fetch filtered Records with GetFilteredRecordsAsync**
10461032

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**
10481034

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.
10501036

10511037
{% tabs %}
10521038
{% highlight razor tabtitle="Index.razor" %}
@@ -1198,7 +1184,7 @@ public class OrderData
11981184

11991185
{% previewsample "https://blazorplayground.syncfusion.com/embed/hjhpZCiFKFFRoZzt?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
12001186

1201-
**2. Using the GetFilteredRecordsAsync() method with remote data**
1187+
**Remote Data**
12021188

12031189
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.
12041190

@@ -1304,7 +1290,7 @@ When using a remote data source, the [GetFilteredRecordsAsync](https://help.sync
13041290

13051291
{% previewsample "https://blazorplayground.syncfusion.com/embed/rXLTXiUChxbmPDxX?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
13061292

1307-
**3. Using properties in the FilteredEventArgs object**
1293+
**Accessing filter details via FilteredEventArgs Properties**
13081294

13091295
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:
13101296

@@ -1319,12 +1305,10 @@ public async Task FilteredHandler(FilteredEventArgs args)
13191305
}
13201306
```
13211307

1322-
## Clear filtering using methods
1308+
## Clear filter via programmatically
13231309

13241310
The Syncfusion<sup style="font-size:70%">&reg;</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.
13251311

1326-
The following example demonstrates how to clear filtering in the Grid using the `ClearFilteringAsync` method:
1327-
13281312
{% tabs %}
13291313
{% highlight razor tabtitle="Index.razor" %}
13301314

@@ -1414,8 +1398,6 @@ Filtering events provide customization options for the Syncfusion<sup style="fon
14141398

14151399
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.
14161400

1417-
The following example demonstrates how to prevent filtering for the **ShipCity** column during the `Filtering` event:
1418-
14191401
{% tabs %}
14201402
{% highlight razor tabtitle="Index.razor" %}
14211403

@@ -1527,7 +1509,7 @@ public class OrderData
15271509

15281510
Enum-type data can be filtered in the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid using the Filter Template feature.
15291511

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.
15311513

15321514
{% tabs %}
15331515
{% highlight razor tabtitle="Index.razor" %}

0 commit comments

Comments
 (0)