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
265
Cannot update unbound column after Sort
posted

I have records stored in a DataTable that is bound to an UltraWinGrid.UltraGrid.  I also have SortMulti enabled and I am able to successfully sort on any combination of columns.

Since the sorting causes the Record ID column to be completely unsorted most of the times (as a result of sorting on other columns), I decided to insert an UNBOUND column called "RowID".  

This way, after each time a sorting occurs, I re-write to the RowID column using the grid's AfterSortChange() event.  Example:  RowID = 1, 2, 3, 4, etc.  The problem is that when I do this, my RowID values appear to NOT be updated.  However, after much experimentation, I have come to the conclusion that my attempt to iterate through the Rows collection is a waste of time.  This is because I believe that the ordinal positions of the rows have also been re-arranged due to the sort.

Does anyone have a suggestion on how I can get this working?  I've tried numerous ideas and they all fail -- because of the re-arranged row indexes caused by the sorting.  At least,...this is my belief.

Parents
No Data
Reply
  • 265
    Verified Answer
    posted

    It seems that the ONLY WAY to solve this problem is:

    a)  Remember the sorted columns once they are sorted,

    b)  Re-query the database using a new ORDER BY clause created with the sorted columns from step (a).

    c)  In the load records function, iterate through the remembered columns collection and 're-apply the sort indicators' for the sorted columns.

    Quite a lot of work to get a simple ordered list of row numbers, but it works.  Maybe Infragistics will find a way to make this easier in a future update.

Children