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. Image for the cookie policy date
close icon

SfDataGrid.View.RefreshFilter Scrolls View With No Change To DataSource


After calling sfDataGrid.View.RefreshFilter(), the position of the scrollbar and view is moved upward by a seemingly random amount, even though the DataSource is not changing. This only occurs once after manually scrolling down. After that the scrollbar and view do not move when calling the above function.

I have tried to save and restore the scrollbar's position by doing:

var scrollVal = SfDataGrid.TableControl.ScrollRows.ScrollBar.Value;


TableControl.ScrollRows.ScrollBar.Value = scrollVal;

However, the ScrollRows.ScrollBar.Value property does not change even though I can see the ScrollBar moving. The only scrolling property I found that IS different after refreshing the filter is the SfDataGrid.TableControl.ScrollRows.ScrollLineIndex. I can restore the scroll position by saving this and restoring it after refreshing the filter but unfortunately this can cause the scroll position to jump since it is by row index and not a granular value.

I have verified that the number of records displayed is not changing.

Any help would be appreciated.

3 Replies

DM Dhanasekar Mohanraj Syncfusion Team October 14, 2022 09:05 AM

Hi Robert van der Leek,

We are a little unclear about your scenario. We suspect that you are using view filtering and refreshing the filter. When you are performing the filtering after scrolling the scroll thumb gets adjusted with the filtered records which is the default behavior of our SfDataGrid. And there is no possibility to retain the scroll position in this case. And you mentioned “
I have verified that the number of records displayed is not changing”, could you please confirm whether you mean that the records count presented in the view does not change or the SfDataGrid’s records count does not change (Whether you are applying a filter or not). And share your exact requirement with the video illustration. It will be helpful to proceed with this further.


Dhanasekar M.

RV Robert van der Leek October 31, 2022 12:46 PM

Seems like this actually had to do with setting custom row heights in the QueryRowHeight event. When removing the custom row heights the scroll bar the scroll thumb and view no longer move on filter refresh. This topic can be closed, thanks much.

Robert van der Leek

DM Dhanasekar Mohanraj Syncfusion Team November 1, 2022 09:03 AM

We are glad that the reported issue was resolved on your side. Please let us know if you need any other details on this. As always, we will be happy to assist you.

Live Chat Icon For mobile
Up arrow icon