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
1015
Sort not occurring
posted

I have an UltraWinGrid whose DataSource is an UltraDataSource.

I created a button on the form whose action is to sort the data in the grid on the Carrier column. I use the following code:

                With ugOrderList.DisplayLayout.Bands("Orders")
                    .SortedColumns.Add("Carrier", False, False)
                    .SortedColumns.RefreshSort(True)
                End With

However, when the button is clicked nothing happens. The grid does not sort. If I manually click on the Carrier column, it will sort, but it won't sort programatically.

What's wrong?

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    You should not need to call RefreshSort - adding a sorted column implicitly refreshes the sorting. I imagine you probably just did that because it wasn't working. 

    In what event is this code called? Are there any rows in the grid at the time? Check the grid.Rows.Count. If there are no rows and the rows are getting added later, then you need to sort the column after the rows are added (or call RefreshSort after the rows exist). Rows that are added while the grid is already sorted will not be sorted automatically until you explicitly refresh the sort. This is to prevent rows from jumping around while a user is modifying data.

Children