Does combo support Virtual Mode?

7 posts, 0 answers
  1. Andrew Stanford
    Andrew Stanford avatar
    7 posts
    Member since:
    Jul 2009

    Posted 12 Aug 2009 Link to this post

    I was just wondering how the Multi-column combo supports very large amounts of data... like 1.5 million items. Does it support a virtual mode like the grid control?
  2. Mike
    Admin
    Mike avatar
    640 posts

    Posted 13 Aug 2009 Link to this post

    Hello Andrew Stanford,

    RadMultiColumnComboBox uses RadGridView to display the multi-column list of data. RadGridView support visualization, thus this should not be a problem for RadMutiCoumnComboBox. Here is an article about using grid's virtual mode:
    http://www.telerik.com/help/winforms/programming-virtual-mode.html

    You can access the grid in the multi-column combo, using its property EditorControl:
    this.radMultiColumnComboBox1.EditorControl ...

    Let us know if you hit any obstacles implementing this or if you other questions.

    All the best,
    Mike
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Andrew Stanford
    Andrew Stanford avatar
    7 posts
    Member since:
    Jul 2009

    Posted 13 Aug 2009 Link to this post

    Thanks for the info. The link you sent mentions using a "datacache" for display. Is this a Telerik object or is it something I need to make? If it is something I need to make, do you have a good example of the best way to build it?

    I also note that the example disables sorting, filtering and grouping... are these features supported in virtual mode?

    Does "AutoComplete" still work on the multicolumn combo when it is running in Virtual mode?

  5. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 17 Aug 2009 Link to this post

    Hi Andrew,

    Thanks for writing back. Basically, the Data Cache object represents the current data loaded from the database in the memory of your machine. This object makes sure that only the needed data is available for display. In other words, when you have 1.5 Million rows of information in your database and you want to display them to the user, only certain rows are downloaded from the database and stored in the computer memory. The cache object determines which rows are downloaded and how are they stored. For instance, you may want to download the first 20 rows and display them. After the user scrolls, you may want to download 20 rows with an offset 2 from the first row and display them etc. In general, when using the RadGridViewControl in Virtual Mode, you define the way the control interacts with its data source.

    Unfortunately, we do not have examples how to design a caching mechanism since different scenarios require different implementations. However, there is a helpful article in MSDN that should give you the idea of how you could build your caching mechanism:

    Implementing Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control

    I have also prepared a simple code snippet that demonstrates how to prepare the RadMultiColumnComboBox control for Virtual Mode:

    public partial class Form1 : RadForm 
        { 
            public Form1() 
            { 
                InitializeComponent(); 
                this.radMultiColumnComboBox1.EditorControl.VirtualMode = true
                this.radMultiColumnComboBox1.EditorControl.ColumnCount = 5; 
                this.radMultiColumnComboBox1.EditorControl.RowCount = 50000; 
                this.radMultiColumnComboBox1.EditorControl.CellValueNeeded += new GridViewCellValueEventHandler(radGridView1_CellValueNeeded); 
                this.radMultiColumnComboBox1.EditorControl.CellValuePushed += new GridViewCellValueEventHandler(radGridView1_CellValuePushed); 
                this.radMultiColumnComboBox1.EditorControl.SortChanged += new GridViewCollectionChangedEventHandler(radGridView1_SortChanged); 
                this.radMultiColumnComboBox1.EditorControl.GroupByChanged += new GridViewCollectionChangedEventHandler(radGridView1_GroupByChanged); 
                this.radMultiColumnComboBox1.EditorControl.FilterChanged += new GridViewCollectionChangedEventHandler(radGridView1_FilterChanged); 
            } 
     
            void radGridView1_FilterChanged(object sender, GridViewCollectionChangedEventArgs e) 
            { 
                //Instruct the cache to filtered rows. 
            } 
     
            void radGridView1_GroupByChanged(object sender, GridViewCollectionChangedEventArgs e) 
            { 
                //Instruct the cache to retrieve groups. 
            } 
     
            void radGridView1_SortChanged(object sender, GridViewCollectionChangedEventArgs e) 
            { 
                //Instruct the cache to retrieve sorted rows. 
            } 
     
             
     
            void radGridView1_CellValuePushed(object sender, GridViewCellValueEventArgs e) 
            { 
                //Write the value for the cell with the index contained in the GridViewCellValueEventArgs object. 
                //The value is stored in the cache. 
            } 
     
            void radGridView1_CellValueNeeded(object sender, GridViewCellValueEventArgs e) 
            { 
                //Display the value for the cell with the index contained in the GridViewCellValueEventArgs object. 
                //The value is read from the cache. 
            } 
        } 

    RadMultiColumnComboBox does not support AutoComplete in Virtual Mode. You can, however, use the TextChanged event to give the user hints of possible matches to their input.

    I hope these hints are helpful.

    Greetings,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Andrew Stanford
    Andrew Stanford avatar
    7 posts
    Member since:
    Jul 2009

    Posted 04 Sep 2009 Link to this post

    I have implemented a cache based on the information at the link you suggested and it does work very well. The problem is that when I execute this code;
    this.cboPart.MultiColumnComboBoxElement.EditorControl.RowCount = retrieverPart.RowCount; 
    ...it takes about 20 seconds to run. The retriever.RowCount just gets the row count and the execution time is about 10 milliseconds... so the delay is adding rows to the DataGrid, of which there are 1.6 million.

    On the standard .Net DatGridView I used this;
                            if (this.dataGrid.Rows.Count == 0)  
                            {  
                                this.dataGrid.Rows.Add();  
                            }  
                            if (this.RecordCount > 1)  
                            {  
                                this.dataGrid.Rows.AddCopies(this.dataGrid.Rows.Count - 1, this.RecordCount - 1);  
                            }  
     
    ...which ran very quickly. I looked for something similar in the RadGrid, but all the documentation seems to suggest just setting the RowCount property.

    Any ideas on how to get this running quickly? I thought of running on a background worker thread as the form loads, but apart from being a nasty old work around, it wouldn't be able to access the combobox on the main thread, so wouldn't work anyway.
  7. Andrew Stanford
    Andrew Stanford avatar
    7 posts
    Member since:
    Jul 2009

    Posted 04 Sep 2009 Link to this post

    I have to say also that the EnsureVisible() method to select a row is also very slow with this many rows.
  8. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 08 Sep 2009 Link to this post

    Hi Andrew Stanford,

    We found some problems when more than 1 million rows are added. We planned more fixes and improvements in VirtualMode functionality for RadGridView and MultiColumnCombo in the next major release. Thank you for your cooperation. 

    All the best,
    Julian Benkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for WinForms is Visual Studio 2017 Ready