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.
Hi John,
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
John,
How about using the 'BeforeSortChange' event of the 'UltraGrid' in order to get the unsorted rows? You could also use the 'GetCellValue()' method on the rows if you want to get a particular value. Would this help?
Am I missing something here?
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.