We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to skip the frozen row data from filtering in the SfDataGrid?

The SfDataGrid provides support to freeze the rows and columns like Excel’s FreezePanes. By default, the filtering feature allows you to filter the data in the rows based on particular criteria. Initially, the Filter Popup is loaded with the FilterElements and the value of the FilterElements is the display value of the corresponding column. Once you filter, the FilterElements are reset based on the specified conditions. It does not have any special option to skip freezing the row data on filtering.

The following screenshot illustrates how the Filter Popup is loaded with its FilterElements when the FrozenRowsCount is defined in the SfDataGrid.

 

Figure 1: Default view of frozen rows in Filtering

In the SfDataGrid, it is possible to skip the frozen row data and maintain these frozen rows in view of the SfDataGrid on filtering. This can be achieved by using the FilterItemsPopulated and FilterChangingEvent events of the SfDataGrid.

These events are wired as shown in the following code example.

C#

 

The FilterItemsPopulated event is raised when the filter item list is populated and the ItemsSource of the GridFilterControl is set. With the help of this event, you can manage filter values and avoid frozen row data being populated into the filter item list as shown in the following code example.

C#

 

From the above code, you can get the filter values collection from the e.ItemSource argument of the GridFilterItemsPopulatedEventArgs class. To get the frozen rows count, use the FrozenRowsCount property of the SfDataGrid. Then remove those frozen rows from the e.ItemSource collection. This is represented in the following screenshot.

Figure 2: Frozen row data removed from Filter values

Retain the frozen row data in view by using the FilterChanging event of the SfDataGrid and that is used to manage the FilterPredicates collection. In the code, the frozen row data is added to the filter predicates by using the e.FilterPredicates argument.

C#

 

The following screenshot illustrates that after filtering, the frozen row data is retained in view of the SfDataGrid:

Figure 3: Frozen row data retained in view after applied Filtering

Sample Links:

WPF

WinRT

UWP

Article ID: Published Date: Last Revised Date: Platform: Control:
6032 01/20/2016 01/20/2016 UWP SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.