GridView Grouping Performance

4 posts, 0 answers
  1. Andy
    Andy avatar
    16 posts
    Member since:
    Aug 2012

    Posted 21 Feb 2013 Link to this post

    Hi,

    I have a GridView that can return anything from 500 to 10,000 records. When the results are returned from the database I apply a default grouping on 2 of the columns, both are string values. Up to about 5000 records this works fine. After that the performance deteriorates rapidly. Is this just a limitation of the GridView or can I do something to improive the situation?

    XAML for the Grid is below. I am using version 2012.3.1129.1050.

    <telerik:RadGridView ItemsSource="{Binding Path=Cases}" IsBusy="{Binding Path=Loading}"
                                   Style="{StaticResource RadGridViewStyle}" AutoExpandGroups="False">
                <telerik:RadGridView.GroupDescriptors>
                  <telerik:ColumnGroupDescriptor DisplayContent="{StaticResource ClientTitle}">
                    <telerik:ColumnGroupDescriptor.Column>
                      <Binding Path="Columns[3]">
                        <Binding.RelativeSource>
                          <RelativeSource Mode="FindAncestor" AncestorType="telerik:RadGridView" AncestorLevel="1" />
                        </Binding.RelativeSource>
                      </Binding>
                    </telerik:ColumnGroupDescriptor.Column>
                  </telerik:ColumnGroupDescriptor>
      
                  <telerik:ColumnGroupDescriptor DisplayContent="{StaticResource CaseTypeTitle}">
                    <telerik:ColumnGroupDescriptor.Column>
                      <Binding Path="Columns[4]">
                        <Binding.RelativeSource>
                          <RelativeSource Mode="FindAncestor" AncestorType="telerik:RadGridView" AncestorLevel="1" />
                        </Binding.RelativeSource>
                      </Binding>
                    </telerik:ColumnGroupDescriptor.Column>
                  </telerik:ColumnGroupDescriptor>
                </telerik:RadGridView.GroupDescriptors>
      
                <telerik:RadGridView.SelectedItem>
                  <Binding Path="SelectedCase" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" />
                </telerik:RadGridView.SelectedItem>
      
                <telerik:RadGridView.Columns>
                  <helpers:RowNumberGridViewColumn />
      
                  <telerik:GridViewDataColumn Header="{StaticResource CaseNumber}"
                                              Width="110" IsFilterable="True" IsReorderable="True" IsResizable="True" IsSortable="True">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                      <telerik:CountFunction Caption="Count: " />
                    </telerik:GridViewDataColumn.AggregateFunctions>
                    <telerik:GridViewDataColumn.DataMemberBinding>
                      <Binding Path="MECaseNumber" StringFormat="000000000" />
                    </telerik:GridViewDataColumn.DataMemberBinding>
                  </telerik:GridViewDataColumn>
      
                  <telerik:GridViewDataColumn Header="{StaticResource Client_Reference}" Width="*" IsFilterable="True" IsReorderable="True" IsResizable="True" IsSortable="True">
                    <telerik:GridViewDataColumn.DataMemberBinding>
                      <Binding Path="ClientReference" TargetNullValue="None" />
                    </telerik:GridViewDataColumn.DataMemberBinding>
                  </telerik:GridViewDataColumn>
      
                  <telerik:GridViewDataColumn Header="{StaticResource ClientTitle}"
                                              DataMemberBinding="{Binding Path=RelationshipsSummary.ClientName}"
                                              Width="*" IsFilterable="True" IsReorderable="True" IsResizable="True" IsSortable="True" />
      
                  <!-- CaseType is needed on the client anyway to calculate IsCurrent. -->
                  <telerik:GridViewDataColumn Header="{StaticResource CaseTypeTitle}"
                                              DataMemberBinding="{Binding Path=CaseType.Name}"
                                              Width="*" IsFilterable="True" IsReorderable="True" IsResizable="True" IsSortable="True" />
      
                  <!-- CaseStatus is needed on the client anyway to calculate IsCurrent. -->
                  <telerik:GridViewDataColumn Header="General Status"
                                              DataMemberBinding="{Binding Path=CaseStatus.GeneralStatus}"
                                              Width="*" MinWidth="110" IsFilterable="True" IsReorderable="True" IsResizable="True" IsSortable="True" />
      
                  <telerik:GridViewDataColumn Header="{StaticResource Country}" MinWidth="112"
                                              Width="*" IsFilterable="True" IsReorderable="True" IsResizable="True" IsSortable="True">
                    <telerik:GridViewDataColumn.DataMemberBinding>
                      <Binding Path="RelationshipsSummary.Jurisdiction" TargetNullValue="{StaticResource CellNull}" />
                    </telerik:GridViewDataColumn.DataMemberBinding>
                  </telerik:GridViewDataColumn>
      
                  <telerik:GridViewDataColumn Header="{StaticResource ApplicationNumber}"
                                              Width="*" MinWidth="120" IsFilterable="True" IsReorderable="True" IsResizable="True" IsSortable="True">
                    <telerik:GridViewDataColumn.DataMemberBinding>
                      <Binding Path="RelationshipsSummary.ApplicationNumber" TargetNullValue="{StaticResource CellNull}" />
                    </telerik:GridViewDataColumn.DataMemberBinding>
                  </telerik:GridViewDataColumn>
      
                  <telerik:GridViewDataColumn x:Name="IsCurrentColumn" UniqueName="IsCurrent"
                                              DataType="system:Boolean" DataMemberBinding="{Binding Path=IsCurrent}"
                                              IsFilterable="True" IsVisible="False" />
                </telerik:RadGridView.Columns>
              </telerik:RadGridView>


  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 Feb 2013 Link to this post

    Hello,

    Please set the GroupRenderMode of the GridView to be "Flat". This should improve the performance in grouped scenario. Would you please confirm how this behaves for your case?

    All the best,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Richard
    Richard avatar
    1 posts
    Member since:
    Feb 2013

    Posted 28 Feb 2013 Link to this post

    Hi Didie. Thank you for your prompt response.

    Flat group render mode gave a slight improvement, but not what we were looking for. It turned out that flattening the object graph gave a much more significant improvement. In the XAML above, the group descriptors bind to columns that themselves are bound as so:

    <GridViewDataColumn DataMemberBinding="{Binding Path=RelationshipsSummary.ClientName}" />
    <GridViewDataColumn DataMemberBinding="{Binding Path=CaseType.Name}" />


    They are now bound as so:

    <GridViewDataColumn DataMemberBinding="{Binding Path=ClientName}" />
    <GridViewDataColumn DataMemberBinding="{Binding Path=CaseType}" />

    The other column bindings have also been simplified. We’d be interested to know why this is so much faster.

    Regards,

    Richard.

  4. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 28 Feb 2013 Link to this post

    Hi,

    RadGridView has special code that optimizes such cases (with simple properties (we consider this case as default)). When there are nested properties (baseClassProperty.Property) then RadGridView creates an ordinary data binding which is a little bit slower.

    Kind regards,
    Nedyalko Nikolov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top