Hello,
I have some problem with UltraWinGrid. I modify some Cell when i running, but if i modifed a grouped Cell, le group isn't refresh.
i programming that for repair the problem
-----------------------------------
Private Sub UltraGrid_AfterCellUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles UltraGrid.AfterCellUpdate If isGrouped(e.Cell.Column.Index) Then ResetGroup() End If End Sub
Private Function isGrouped(ByVal Colomns As Integer) For i As Integer = 0 To Me.UltraGrid.DisplayLayout.Bands(0).SortedColumns().Count - 1 If Me.UltraGrid.DisplayLayout.Bands(0).SortedColumns(i).Index = Colomns Then Return True End If Next i Return False End Function Private Sub ResetGroup() Dim liste As New Generic.List(Of Colomns) For i As Integer = 0 To Me.UltraGrid.DisplayLayout.Bands(0).SortedColumns().Count - 1 Dim temp As Colomns temp.Colomns = Me.UltraGrid.DisplayLayout.Bands(0).SortedColumns(i) temp.descending = Me.UltraGrid.DisplayLayout.Bands(0).SortedColumns(i).SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending temp.groupBy = Me.UltraGrid.DisplayLayout.Bands(0).SortedColumns(i).IsGroupByColumn liste.Add(temp) Next i Me.UltraGrid.DisplayLayout.Bands(0).ColumnFilters.ClearAllFilters() Dim iterator As Generic.List(Of Colomns).Enumerator = liste.GetEnumerator While iterator.MoveNext Me.UltraGrid.DisplayLayout.Bands(0).SortedColumns.Add(iterator.Current.Colomns, iterator.Current.descending, iterator.Current.groupBy) End While End Sub
That work, all group is refresh and if i modify a cell and this cell is grouped, the rows change of group
but the problem, all group is collapse.
How i can expand some group by the code ???
Thanks
Waxime
Softicket Programmer
http://www.softicket.net
The grid does not automatically re-group or re-sort when the value of a cell changes, because this might be jarring for users to edit a cell and have the row move to a new position.
But if you want to refresh the sorting or grouping, all you have to do is call:
private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e) { e.Cell.Band.SortedColumns.RefreshSort(true); }
Hi Mike,
won't it effect the performance (cell updation), if the grid cells is getting updated very frequently...
Sure it will. That's another reason why the grid does not do this automatically every time a value changes. This way, you can refresh the sorting when you want to.
I know this one is a bit hold but hopefully you can help. The resorting/grouping works when I execute the RefreshSort method. The problem is that at each time it seems that the whole grid is rebuilt and, consequently, the grid scrolls all the way up. Is there a way to prevent this behavior from occurring?
Thanks-Szymon
How can you expand only the band of the the grouped column item belongs to?
For example if it belongs to band[0] and I would only the the band[0] of all groups and not the bands below like band[1] and band [2].
Hi Szymon,
I'm not sure why this is happening or if it is preventable. The grid should in theory, be re-using the same UIElements and the Row objects.
But where exactly do you want to the grid to be scrolled to? The rows that were in view before you refreshed the grouping/sorting may not be in the same order they were in previously. So do you want the grid to scroll the previously active row into view? Do you want the same row at the top of the grid? Do you want the same scroll position, regardless of what rows are now in that position?