We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

sort summary child rows

Hello, I have one syncfusion GridGroupingControl which I have some grouped columns with custom summaries appearing when the groups are collapsed. I am trying to sort the column by both the summary and the child rows.

In order to have the columns sorted by the summary. I used the following code in the routine that handles the event TableControlQueryAllowSortColumn of the control:

' tem coluna agrupando?
            If (Me.TableDescriptor.GroupedColumns.Count > 0) Then

                ' pega a coluna clicada
                _ColunaNomeClicada = e.Column.FieldDescriptor.Name

                ' coluna clicada está no conjunto de colunas sumarizadas?
                If (Me.TableDescriptor.SummaryRows.Count > 0) AndAlso _
                    (Me.TableDescriptor.SummaryRows.Item(0).SummaryColumns.Contains(_ColunaNomeClicada) = True) Then

                    ' pega a coluna sumarizada
                    _ColunaSumarizada = Me.TableDescriptor.SummaryRows.Item(0).SummaryColumns(_ColunaNomeClicada)

                    ' determina o nome da propriedade de sumarizacao
                    ' de acordo com o tipo de sumarizacao
                    Select Case _ColunaSumarizada.SummaryType
                        Case SummaryType.Custom
                            _PropriedadeSumarizacao = "Valor"
                        Case SummaryType.DoubleAggregate
                            _PropriedadeSumarizacao = "Sum"
                        Case Else
                            _PropriedadeSumarizacao = "Sum"
                    End Select ' de acordo com o tipo de sumarizacao

                    ' eh a coluna que esta na ordenacao?
                    If (Me.TableDescriptor.SortedColumns.Count > 0) AndAlso _
                        (Me.TableDescriptor.SortedColumns.Contains(_ColunaSumarizada.Name) = True) Then

                        ' verifica a ordenacao atual
                        If (Me.TableDescriptor.SortedColumns.Item(_ColunaSumarizada.Name).SortDirection = System.ComponentModel.ListSortDirection.Ascending) Then
                            _ColunaDirecaoOrdenacao = System.ComponentModel.ListSortDirection.Descending
                            _ColunaDirecaoOrdenacao = System.ComponentModel.ListSortDirection.Ascending
                        End If ' coluna tem uma tag com a ordenacao?

                    End If ' eh a coluna que esta na ordenacao?

                    ' percorre colunas agrupadas
                    For Each _ColunaOrdenacao In Me.TableDescriptor.GroupedColumns
                        ' coloca a ordenacao definida para todos os niveis de agrupamento
                        _ColunaOrdenacao.SetGroupSummarySortOrder( _
                            _ColunaSumarizada.GetSummaryDescriptorName, _
                            _PropriedadeSumarizacao, _
                    Next ' percorre colunas agrupadas

it solves the problem of sorting by the summary values but not the children rows. This code is found in many syncfusion samples and forum posts.

1 Reply

AK Arun Kumar V Syncfusion Team August 30, 2013 04:12 AM UTC

Hi Felipe Bahianana almeida,

Thanks for your interest in Syncfusion products.


Sort summary child rows.

To sort the grid from top level to the bottom level you can make use of the following form link which replicates your inquiry.


If the reported behavior could not be achieved please provide me your essential studio version, and the sample file you have customized. So that I can modify it and provide you.

Please let me know if you have any concerns.



Live Chat Icon For mobile
Up arrow icon