Grid with large number of rows and columns

60 posts, 2 answers
  1. amit
    amit avatar
    21 posts
    Member since:
    Nov 2007

    Posted 18 Oct 2010 Link to this post

    HI Vlad,

    I also tried the latest internal build. It fixed "Unexpected behavior with Column Virtualization". I see good performance of horizontal scrolling. I saw the same behavior as Nicolas saw. Horizontal scrolling is 2x slower than vertical scrolling. But it is much better than before.

    Surprisingly, latest assemblies also broke a functionality for me. It broke cell editing functionality - I am using Custom Columns. I already updated support Ticket (ID 356186 - Unexpected behavior with Column Virtualization) with the issue. Sample application is already in support ticket.

    Thank you,
    Amit
  2. amit
    amit avatar
    21 posts
    Member since:
    Nov 2007

    Posted 19 Oct 2010 Link to this post

    HI Vlad,

    FYI: editing issue has been resolved as part of support incident.

    Thank you,
    Amit
  3. Jan
    Jan avatar
    58 posts
    Member since:
    May 2010

    Posted 21 Oct 2010 Link to this post

    Hi, 
    I have tried the latest build, but I don't see any change in performance. I suspect the reason is because I am using custom column layouts.
    Vlad mentioned something about caching the cell content when using custom column, can you give me more feedback on what do you mean by that?

    Thanks :)
  4. Jan
    Jan avatar
    58 posts
    Member since:
    May 2010

    Posted 21 Oct 2010 Link to this post

    Hi, me again :)
    I have done some refactoring on custom columns, and you were right it does work significantly better if I reuse the controls already instantiated :)
    I have created a dictionary that keeps my old controls, but I would like to know more about Vlad's idea of caching.
    Anyway, great work with the new build, I can see that it is performing much better now ;)
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 21 Oct 2010 Link to this post

    Hi,

     Here is an example of caching:

    public class MyColumn : GridViewDataColumn
    {
        public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
        {
            var textBlock = cell.Content as TextBlock;
            if (textBlock == null)
            {
                textBlock = new TextBlock();
                textBlock.SetBinding(TextBlock.TextProperty, DataMemberBinding);
                cell.Content = textBlock;
            }
     
            return textBlock;
        }
    }

    Kind regards,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Jan
    Jan avatar
    58 posts
    Member since:
    May 2010

    Posted 22 Oct 2010 Link to this post

    Thanks,  Vlad :)
  7. Jan
    Jan avatar
    58 posts
    Member since:
    May 2010

    Posted 25 Oct 2010 Link to this post

    Hi Vlad, 
    I have tried this approach, but something is not right... when I use these cached controls, and scroll left and right, my columns get messed up, so for one header name I get column data from a different column.. :S
  8. Jan
    Jan avatar
    58 posts
    Member since:
    May 2010

    Posted 25 Oct 2010 Link to this post

    Interestingly enough, when I do not use custom columns, but auto-generated ones, the performance is much better.. and there is no data shifting bug I find when I try to implement caching...
    What am I doing wrong?
  9. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 28 Oct 2010 Link to this post

    Hello DCMS,

    Could you please send us a sample application which can help us reproduce the issues with your custom column?


    Regards,
    Milan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Alessio
    Alessio avatar
    13 posts
    Member since:
    May 2009

    Posted 23 Nov 2010 Link to this post

    i've the same problem...
    here my code
    using System;
    using System.Collections.Generic;
    using System.Windows;
    using System.Windows.Controls;
    using RadControlsSilverlightApp1.Resources;
      
    using Telerik.Windows.Controls;
      
    namespace RadControlsSilverlightApp1
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                InitializeComponent();
                DataTable table = CreateDataTable();
                foreach (DataColumn column in table.Columns)
                {
                    RadGridView1.Columns.Add(CreateColumn(column.DataType,column.ColumnName,column.ColumnHeader));
                }
      
                RadGridView1.ItemsSource = table;
            }
      
            private static GridViewDataColumn CreateColumn(Type columnType, string dataPath, string header)
            {
                GridViewCustomColumn column = new GridViewCustomColumn
                {
                    DataType = columnType,
                    UniqueName = dataPath,
                    Header = header,
                    HeaderTextAlignment = TextAlignment.Center
                };
      
                return column;
            }
      
         
      
            private static DataTable CreateDataTable()
            {
                DataTable table = new DataTable();
      
                List<String> s = new List<string>();
                for (int i = 0; i < 2; i++)
                {
                    table.Columns.Add(new DataColumn
                                          {
                                              ColumnName = "Prop" + i,
                                              ColumnHeader = "Prop" + i,
                                              DataType = typeof (String)
                                          });
                }
      
      
      
                for (int i = 2; i < 10; i++)
                {
                    table.Columns.Add(new DataColumn
                                          {
                                              ColumnHeader = "Prop"+i,
                                              ColumnName =
                                                  "Prop"+i,
                                              DataType = typeof (CustomCell)
                                          });
                }
      
                int numero=0;
                for (int i = 0; i < 100; i++)
                {
                    numero++;
                    var r = table.NewRow();
                    foreach (DataColumn column in table.Columns)
                    {
                        if (column.DataType == typeof(String))
                        {
                            r[column.ColumnName] = "Content"+numero;
                        }
                        else
                        {
                            r[column.ColumnName] = new CustomCell
                            {
                                P1 = 100,
                                P2 = 90,
                                P3 = "%",
                                P5 = "../Images/greenSemaphore.png",
                                P4 = -1
                            };
                        }
                    }
                    table.Rows.Add(r);
                }
                return table;
            }
        }
    }
    <UserControl x:Class="Dashboard.Silverlight.Resources.CustomCellLayout"
        mc:Ignorable="d">
      
        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid x:Name="Grid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
      
                <StackPanel Grid.Row="1" Orientation="Horizontal" Width="45" >
                    <TextBlock x:Name="TextBlockP1" Margin="5 2 5 2" Foreground="Black"/>
                </StackPanel>
                <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Width="45">
                    <TextBlock Margin="5 2 5 2" x:Name="TextBlockP2" />
                </StackPanel>
                <StackPanel Grid.Row="1" Grid.Column="2" Orientation="Horizontal" Width="45">
                    <TextBlock Margin="5 2 5 2" x:Name="TextBlockP3" Foreground="Blue"/>
                </StackPanel>
                <StackPanel Grid.Row="1" Grid.Column="3" Orientation="Horizontal" Width="20">
                    <Image Width="16" x:Name="CircleImage" Height="16"
                                                            Margin="5 2 5 2" VerticalAlignment="Center" />
                </StackPanel>
            </Grid>
        </Grid>
    </UserControl>
    using System;
    using System.Collections.Generic;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using Dashboard.Silverlight.Resources;
    using RadControlsSilverlightApp1.Dynamic;
    using Telerik.Windows.Controls;
    using Telerik.Windows.Controls.GridView;
      
    namespace RadControlsSilverlightApp1.Resources
    {
        public class GridViewCustomColumn : GridViewDataColumn
        {
            public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
            {
                FrameworkElement element = null;
                object currentProperty = null;
                DynamicObject data = dataItem as DynamicObject;
                if (data != null)
                    currentProperty = data.GetVal(cell.Column.UniqueName);
    /*
    I've add this method to DynamicObject

    public virtual object GetVal(string propertyName)
            {
                object value;
                if (!this.valuesStorage.TryGetValue(propertyName, out value))
                {
                    return default(object);
                }

                return value;
            }


    */
                if (currentProperty is CustomCell)
                {
                    var bar = cell.Content as CustomCellLayout;
      
                    CustomCell wrapper = currentProperty as CustomCell;
                    if (bar == null)
                    {
                        bar = new CustomCellLayout();
      
                        if (!Double.IsInfinity(wrapper.P1))
                        {
                            bar.TextBlockP1.Text = String.Format("{0:n0} {1}", wrapper.P1, wrapper.P3);
                            bar.TextBlockP2.Text = String.Format("{0:n0} {1}", wrapper.P2, wrapper.P3);
                            bar.TextBlockP3.Text = String.Format("{0:n0} {1}", wrapper.P1 - wrapper.P2, wrapper.P3);
                        }
                        else
                        {
                            bar.TextBlockP1.Text = "-";
                            bar.TextBlockP2.Text = "-";
                            bar.TextBlockP3.Text = "-";
                        }
      
                        if (wrapper.P4 < 0)
                        {
                            bar.TextBlockP3.Foreground = new SolidColorBrush(Colors.Red);
                        }
                        if (wrapper.P4 == 0)
                        {
                            bar.TextBlockP3.Foreground = new SolidColorBrush(Colors.Orange);
                        }
                        if (wrapper.P4 > 0)
                        {
                            bar.TextBlockP3.Foreground = new SolidColorBrush(Colors.Green);
                        }
                          
                        bar.CircleImage.Source = new BitmapImage(new Uri(wrapper.P5, UriKind.RelativeOrAbsolute));
      
                        element = bar;
                        cell.Content = bar;
                    }
                }
                  
                if (currentProperty is String || currentProperty == null)
                {
                    var bar = cell.Content as TextBlock;
                    if (bar == null)
                    {
                        bar = new TextBlock();
      
                        bar.Text = currentProperty != null ? currentProperty.ToString() : "-";
                        bar.Foreground = new SolidColorBrush(Colors.White);
                        LinearGradientBrush background = new LinearGradientBrush();
                        background.EndPoint = new Point(0.5, 1);
                        background.StartPoint = new Point(0.5, 0);
                        background.GradientStops.Add(new GradientStop { Color = 0xFF0E7094.ToColor(), Offset = 1 });
                        background.GradientStops.Add(new GradientStop { Color = 0xFF1990B1.ToColor() });
      
                        cell.Background = background;
                        element = bar;
                        cell.Content = bar;
                    }
                }
      
                return element;
            }
       }
    }
  11. Valdo
    Valdo avatar
    26 posts
    Member since:
    Aug 2010

    Posted 28 Dec 2010 Link to this post

    Any progress on increasing performance of horizontal scroll? I'm having same issue with columns, which were created in code behind with custom cellstyles applied...
  12. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Dec 2010 Link to this post

    Hi,

     Yes we have serious progress here and we will do our best to include the new horizontal virtualization with our Q1 2011 Beta (end of January probably).

    Greetings,
    Vlad
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  13. Valdo
    Valdo avatar
    26 posts
    Member since:
    Aug 2010

    Posted 29 Dec 2010 Link to this post

    Can you give me any workaround for now? Even if I turn off CellStyles horizontal scrolling of ~70 column is kinda slow.
  14. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Dec 2010 Link to this post

    Hello,

     Have you tried to set fixed with for all columns? For example ColumnWidth="100".

    Kind regards,
    Vlad
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  15. Valdo
    Valdo avatar
    26 posts
    Member since:
    Aug 2010

    Posted 29 Dec 2010 Link to this post

    Yes, I've tried this, it boosted scroll, though, I need different width for different columns depending on their content and custom CellStyle
  16. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Dec 2010 Link to this post

    Hi,

     With our latest version you can enable deferred horizontal scrolling (ScrollMode="Deferred") - may help you in your case. 

    All the best,
    Vlad
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  17. Valdo
    Valdo avatar
    26 posts
    Member since:
    Aug 2010

    Posted 29 Dec 2010 Link to this post

    Just tried with ColumnWidth="150" ScrollMode="Deferred" and Cell Styles enabled. It doesn't look good. Looking forward for your future updates then!
  18. Dan
    Dan avatar
    9 posts
    Member since:
    Jan 2011

    Posted 13 Mar 2011 Link to this post

    Hi

    We have the same issue. Out grid has 90 columns (mostly strings) and is very slow when scrolling.
    When can we expect an update? That would be great.

    Thanks
  19. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 14 Mar 2011 Link to this post

    Hi,

     The release will be this week. For more info you can check my blog post and this demo

    Best wishes,
    Vlad
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  20. Mark
    Mark avatar
    32 posts
    Member since:
    Aug 2010

    Posted 14 Mar 2011 Link to this post

    We're seeing very similar problems here during load, and also on scrolling (differed scrolling is required as otherwise unusable)

    100-1000+ rows
    20-50 columns (user definable)

    for a row load of 100 and a column count of 45 (where 60% of cells have values)
    the query takes ~2s from RIA service context.Load() to DataSource.DataLoaded event
    the grid.ItemsSource = context.Object.ToList(); grid.updatelayout() reports its done in under a second, but if you time to when the UI becomes active (e.g. set the focus of a button after the updatelayout) its between 5 & 6 seconds

    timing is via DateTime - DateTime and not subjective - increasing or decreasing the size of the data/column count various the time dramatically (number of columns proportional to load time)

    changing the columns via 
    this.RadGridView.Columns.RemoveItems(this.PropertyColumns);
    this.PropertyColumns.Clear();
    // add to PropertyColumns
    this.RadGridView.Columns.AddRange(this.PropertyColumns);

    also causes a hang of 5-6s for 40 columns

    --Edit: Vlad posted a response whilst this post was compiled
    It seems that 11 Q1 release looks much better re performance
  21. Andrew
    Andrew avatar
    7 posts
    Member since:
    Oct 2011

    Posted 26 Oct 2011 Link to this post

    We had somewhat of a breakthrough! The radgridview (WPF) was in an "Auto" sized row of a grid, so it thought it was a lot bigger than it was, and it was not able to do the row virtualization that we thought it would.

    With the radgridview in a row of height "*" the rowvirtualization works and we don't get a black screen or a big freeze up.
  22. Kannan
    Kannan avatar
    26 posts
    Member since:
    Nov 2009

    Posted 09 Nov 2011 Link to this post

    Hi,

        Is it possible to set Deffered for Vertical scrolling and RealTime for Horizontal scrolling ?

    Thanks & Regards,
    Kannan
  23. Anjani
    Anjani avatar
    21 posts
    Member since:
    Mar 2011

    Posted 29 May 2012 Link to this post

    Hi Stefan,

    My scenario is quite relevant to this thread of discussions. Telerik controls that we are using are of the version 2011.1.502.1040.
    In my silverlight project, I'm using a telerik grid with virtual scrollling activated. I have users close to 1000 being shown on the grid. pagesize is 150. When I select the 1st row, and scroll down to the last user for selection (shift pressed), trying to select all users , selection happens. But if I repeat this again and again, my browser hangs. The call stack at this moment is mentioned below. Hristo had mentioned in an earlier post that the performance for VirtualQueryableCollectionView will be improved in Q3 2010 Beta release. So wanted to to know what is the current statues of this issue ?

        [Managed to Native Transition]    
         System.Windows.dll!MS.Internal.XcpImports.DependencyObject_GetVisualRelative(System.Windows.DependencyObject referenceObject, int linkType) + 0x4d bytes    
         System.Windows.dll!System.Windows.Media.VisualTreeHelper.GetRelative(System.Windows.DependencyObject reference, System.Windows.Media.VisualTreeHelper.RelativeKind relativeKind) + 0x40 bytes    
         Telerik.Windows.Controls!Telerik.Windows.RadRoutedEventHelper.FindParent(System.Windows.FrameworkElement item) + 0x37 bytes    
         Telerik.Windows.Controls!Telerik.Windows.RadRoutedEventHelper.BuildRoute(System.Windows.DependencyObject element, Telerik.Windows.EventRoute route, Telerik.Windows.RadRoutedEventArgs args) + 0x7d bytes    
         Telerik.Windows.Controls!Telerik.Windows.RadRoutedEventHelper.RaiseEvent(System.Windows.DependencyObject element, Telerik.Windows.RadRoutedEventArgs args) + 0x4a bytes    
         Telerik.Windows.Controls.GridView!Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseSelectionChangedEvent(Telerik.Windows.Controls.SelectionChangeEventArgs args) + 0x13 bytes    
         Telerik.Windows.Data!Telerik.Windows.Controls.DataControl.RaiseSelectionChangedEvent(Telerik.Windows.Data.Selection.ItemSelectionChange selectionChange) + 0x48 bytes    
         Telerik.Windows.Data!Telerik.Windows.Controls.DataControl.Telerik.Windows.Data.Selection.ISelectorInternal.RaiseSelectionChangedEvent(Telerik.Windows.Data.Selection.ItemSelectionChange selectionChange) + 0x6 bytes    
         Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.EndAllowedSelection(Telerik.Windows.Data.Selection.ItemSelectionChange selectionChange) + 0x56 bytes    
         Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.EndPendingSelection(Telerik.Windows.Data.Selection.ItemSelectionChange pendingSelection) + 0x37 bytes    
         Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.EndSelection() + 0x31 bytes    
         Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + 0x77 bytes    
         System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<object>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + 0x34 bytes    
         System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<System.__Canon>.InsertItem(int index, System.__Canon item) + 0x94 bytes    
         mscorlib.dll!System.Collections.ObjectModel.Collection<object>.Add(object item) + 0x69 bytes    
         mscorlib.dll!System.Collections.ObjectModel.Collection<object>.System.Collections.IList.Add(object value) + 0x97 bytes
  24. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 30 May 2012 Link to this post

    Hi,

     We are not sure what is causing the issue at your end however you can check the actual grid performance on this demo. The grid is bound to 1 mil. records with 1000 columns. 

    Greetings,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  25. Anjani
    Anjani avatar
    21 posts
    Member since:
    Mar 2011

    Posted 30 May 2012 Link to this post

    Well,

    in my case the problem occurs because I have multi select behaviour active on the grid. Browser hangs when I try to select around 100 users on mouse drag and scroll up and down. That is the time when the browser hangs and the call stack I have alreday shared with you. Has there been any performance improvement in the telerik grid recently ?
  26. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 30 May 2012 Link to this post

    Hi,

    We believe that since your version there were serious amount of performance improvements.Please try your scenario with our latest official version (Q1 2012 SP1) and let us know how it goes. 

    Next week we will release our Q2 2012 - if you want you can wait for the new release and use it directly instead our current official. 

    Kind regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  27. Anjani
    Anjani avatar
    21 posts
    Member since:
    Mar 2011

    Posted 30 May 2012 Link to this post

    Sure Vlad..

    As suggested by you, I shall wait for the new release.. thanks a lot...
  28. Anjani
    Anjani avatar
    21 posts
    Member since:
    Mar 2011

    Posted 08 Oct 2012 Link to this post

    Hi Vlad,

    My new version of telerik controls is : 2012.2.725.1050 and my problem continues to exist. Is this issue resolved in my version of telerik controls ?

    Regards
    Anjani
  29. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 09 Oct 2012 Link to this post

    Hello Anjani,

    As far as I can see you are using PageSize along with the VirtualQueryableCollectionView. Basically, the idea behind data virtualization is to load data on-demand depending on LoadSize property. In this case using PageSize is not necessary. You can either choose using RadDataPager or DataVirtualization.

    I am attaching a sample project where the multiple selection works as expected.

    Let me know if you have additional questions.

    Regards,
    Yordanka
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  30. Raj
    Raj avatar
    1 posts
    Member since:
    Feb 2014

    Posted 01 Feb 2014 Link to this post

    Hi,
          I I have requirement from client where in  business wanted to replace their excel sheet with Gridview control on a web application. Just wondering if TELERIK can support here for 1000 columns and 150,000 records on a Gridview. I would greatly appreciate your suggestions here.
Back to Top