Hi,
I have a CheckBox to allow a user to select whether or not they would want a list to be auto sorted with the following in a CheckChanged event:
if (this.ultraCheckEditorAutoSort.Checked) {this.ultraGridUsers.DisplayLayout.Bands[1].SortedColumns.Clear();this.ultraGridUsers.DisplayLayout.Bands[1].SortedColumns.Add("Alias", false);this.ultraGridUsers.DisplayLayout.Bands[0].SortedColumns.Add("GroupID", false);}else{this.ultraGridUsers.DisplayLayout.Bands[1].SortedColumns.Clear();this.ultraGridUsers.DisplayLayout.Bands[1].SortedColumns.Add("AutoID", false);this.ultraGridUsers.DisplayLayout.Bands[0].SortedColumns.Add("AutoID", false);}
The problem is when I have it sorted and I add a new row, it will not be automatically sorted. It will work if you toggle off and on the AutoSort option (checkbox) again. My question is: is there a way to implement AutoSort automatically and/or is there a way to refresh the grid after I add a row?
Thanks in advance
Hello,
You probably have to Refresh the SortedColumns once you've changed the rows collection:
this.ultraGridUsers.DisplayLayout.Bands[Index].SortedColumns.RefreshSort(bool obj);
where the "obj" determine to re-group your ultraGrid or not.
Hope this helps.
Thanks for your reply. I tried to do that after I added a new row but it didn't seem to work.
Interestingly without that fix, the sorting seemed to work on Group 2 and on. Attached is a screen shot for reference. I want to sort it based on the first column.
I would like to also note, I'm adding the rows programatically and the "AfterRowInsert" event isn't firing.