This is a migrated thread and some comments may be shown as answers.

UI Virtualization techniques

1 Answer 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Harrigan
Top achievements
Rank 1
Richard Harrigan asked on 23 Aug 2013, 02:59 AM
Hi,

I am executing sql queries that are returning over 100,000 rows.  The grid visualization handles these large results easily.  From what I can gather the rows visible on screen are in memory and the rest are in some kind of cache.  I am saving the results that I set in itemssource for future review where the client does not have access to the database. I want to provide a result viewer where the client can drill down on very large data sets using the excellent adhoc filtering capabilities of the grid   The major problem that I am having is the amount of time it takes to serialize and deserialize and sometimes getting out of memory.  Since the grids UI virtualization capabilities must have dealt with these issues in some form I was hoping that you could provide me with some ideas on how to handle the serialization problem.

The following shows the coding to get the data. clientData.Result is what needs to be serialized and deserialized.  As you can see this is generic code to handle any resultset.  

clientData.Result = new ObservableCollection<dynamic>()

while (dataReader.Read())
{
  Dictionary<string, object> clientRow = new Dictionary<string, object>();

         for (int i = 0; i < dataReader.FieldCount; i++)
         {
             string myKey = clientData.ColumnInfo[i].UniqueColumnName;
             object myValue = null;

             if (DBNull.Value != dataReader[i] && clientData.ColumnInfo[i].ProviderSpecificDataType != "Microsoft.SqlServer.Types.SqlHierarchyId")
             {
myValue = dataReader[i];
             }
             clientRow.Add(myKey, myValue);
         }
clientData.Result.Add(new CloudburstUtilities.ClientRow(ToDictionary(clientRow)));
}


public static IDictionary<string, object> ToDictionary(IDictionary<string, object> row)
{
            var dict = new Dictionary<string, object>();
            foreach (KeyValuePair<string, object> column in row)
            {
                dict.Add(column.Key, column.Value);
            }
            return dict;
 }

Thanks
Rich

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 26 Aug 2013, 06:10 AM
Hi,

As you have noted, the virtualization is UI virtualization -- if there are 100 000 data items and your grid is as high as to show only 20 of them, then we only create 20 UI rows -- not 100 000. But we do not cache any data anywhere. If the RadGridView.ItemsSource contains 100 000 items then they are always there -- in memory. We don't have any special data caching techniques whatsoever. That is the job of another layer which RadGridView is not part of.

I am afraid that caching data on the client is beyond the scope of RadGridView, i.e. you would have exactly the same task at hand no matter what ItemsControl you are using to show the data, i.e. the stock WPF DataGrid, a ListBox and so on. RadGridView simply shows what is fed to its ItemsSource -- how it got there is of no concern for RadGridView.

Regards,
Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Richard Harrigan
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or