Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
When/How to use RefreshSortPosition instead of RefreshSort when bound to a datasource
posted

I want to resort my grid when items in the datasource are changed (it's a bindinglist). Calling RefreshSort after I've made modifications works fine, but it seems that using RefreshSortPosition might be a more effective/performant call. However, I'm not sure how to determine the best way to get the affected rows. I don't want to make changes to support using RefreshSortPosition only to have those changes be more expensive than the gains I make by calling it. I thought I could wire to an event on the binding source or grid, but I didn't see an event that seemed appropriate.

Any best practice suggestions on this?

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    RefreshSortPosition is for cases where you know that all of the rows are already sorted and you just need to refresh the position of a single row. So if you know you just added a new row to your data source, it would be more efficient to find that corresponding row in the grid (which would presumably be at the end of the rows collection) and refresh the sort position of that one row.

    The same goes for a row where a value changed in a cell whose column is currently sorted.

    RefreshSort re-sorts everything. So this is best to use only when you cannot determine the row(s) that may have changed. 

Children