Hello,
when I drag a sorted (and merged) column into the GroupBy Area the band.SortedColumns.Count is correct. But as soon as I drag this column from the GroupBy Area again, the entry band.SortedColumns gets lost (and with it the merging of this column).
How can I keep formerly grouped by-columns into the SortedColumns collection?
Thanks!
I don't understand what you mean. Grouping and sorting are tightly linked together. I'm not sure what merging has to do with it, though.
If you ungroup a column, does the column header still show a sort indicator? I would think the column would still be sorted in the same order it was when grouped.
I have exactly the same issue. I have two columns sorted, Client and Rig. I sorted both by Shift-clicking each column. SortIndicators are shown on each column header. I then drag the Client column to the GroupBy box. It still has the sort indicator on it as does the Rig column. I then drag the Client column from the GroupBy box into the grid again and it no longer has the sort indicator on it and the grid is now only sorted by the Rig column. How do we fix this?
Hm, that's odd. I can't see why the column would no longer be sorted. That might be a bug, but it might be the intended behavior for some reason. In any case, it's probably not something that we could change at this point without potentially breaking existing applications.
I recommend that you Submit an incident to Infragistics Developer Support and report this as a bug. At the veryleast, perhaps they can find a workaround. You could probably handle the BeforeSortChange event and work around it there.
If it looks like a bug to you, then you as an Infrigistics employee should go show this to the development staff. I am certain that they would be happy to have this pointed out to them. Perhaps they have not seen it before
Hi David,
I took a look at this and it looks like a bug to me. You should be able to change the e.SortedColumns inside the BeforeSortChange event and have this affect the sorting, but it does not work.
The code would look like this:
private void ultraGrid1_BeforeSortChange(object sender, BeforeSortChangeEventArgs e) { UltraGridBand band = e.Band; // Examine the columns that are currently sorted. foreach (UltraGridColumn originalColumn in band.SortedColumns) { // Look for grouped columns. if (originalColumn.IsGroupByColumn) { // Get the new sorted column. UltraGridColumn newSortedColumn = e.SortedColumns.Exists(originalColumn.Key) ? e.SortedColumns[originalColumn.Key] : null; // If the column was originally grouped, but does not exist in the // e.SortedColumns, it means it is no longer grouped or sorted. if (newSortedColumn == null) { // Add the columm back in so it stays sorted and is just // un-grouped. bool descending = originalColumn.SortIndicator == SortIndicator.Descending; e.SortedColumns.Add(originalColumn.Key, descending); } } } }
But as I said, this currently does not work. You should Submit an incident to Infragistics Developer Support and report this as a bug, so they can get it fixed.
The only other way I can see to work around this is to use a Timer and re-set the sorting on the column after the un-grouping is finished, but that's something of a hack.
Do you have any suggestions as to what I can do as a workaround? The code that I submitted does not do it for a workaround. You cannot change sorting in the BeforeSortChange method either as far as I can tell.