Question data virtualization and ItemsLoading

8 posts, 1 answers
  1. Austin
    Austin avatar
    12 posts
    Member since:
    Aug 2012

    Posted 29 Jan 2013 Link to this post

    Hi,

    From what I understand the purpose of data virtualization is to only keep a finite number of records in memory at any given time.  However, while experimenting I found that the ItemsLoading event only gets called while I scroll down to the bottom of the RadGridView.  Once I am at the final row and start scrolling back up it is no longer being called.  This has led me to believe that records are not being unloaded from memory once they have been scrolled out of view.

    I am wondering if I am missing something as I do not see any cache size member to set how many things to hold in memory at one time.  Any guidance on how to properly utilize the VirtualQueryableCollectionView with the RadGridView would be greatly appreciated.  The example posted is for RIA services, but we are not using RIA.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 30 Jan 2013 Link to this post

    Hello,

     Actually the virtual collection works in a bit different way. You always have strict number of total items (VirtualItemCount) and the collection itself initially is a collection of empty (null) items. When you scroll down the ItemsLoading event will be called and empty (null) items in the collection will be replaced with the new items. When an item is already loaded the collection will not call ItemsLoading event for this item. 

    Regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Austin
    Austin avatar
    12 posts
    Member since:
    Aug 2012

    Posted 30 Jan 2013 Link to this post

    Hey Vlad,

    I have witnessed the behavior you described and it is what I would expect.  However, I am wondering if there is any built in way of setting items of the internal list back to null once they are scrolled out of view.  As it stands if a user slowly scrolled through a data set containing 1,000,000 records; eventually there would be 1,000,000 items sitting in memory which is exactly what I hope to avoid by using data virtualization.

    My main question is whether or not I need to implement my own custom algorithm for clearing records that have been scrolled out of view, or is there a built in way of doing this that I have overlooked?

    Thanks for the reply,
    Austin
  5. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 30 Jan 2013 Link to this post

    Hello Austin,

     There is no built-in algorithm for cleaning items when they are out of view. 

    Greetings,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Austin
    Austin avatar
    12 posts
    Member since:
    Aug 2012

    Posted 30 Jan 2013 Link to this post

    Alright, thanks for the info.  In that case, is there a method of clearing your would recommend?  From what I can see going into the internal list and setting out of view items back to null would be the way to do it.
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 30 Jan 2013 Link to this post

    Hi,

     Indeed setting the item back to null may do the trick. 

    All the best,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Austin
    Austin avatar
    12 posts
    Member since:
    Aug 2012

    Posted 30 Jan 2013 Link to this post

    Hey Vlad,

    So while trying to implement a solution for this I have run into an issue.  I have derived the VirtualQueryableCollectionView class in order to get access to the InternalList member so that I can set the values at various indices back to null.  However, there is a private member called:  loadedIndexes

    As far as I can tell, this private list keeps track of which indexes have been loaded and tells the virtualization methods to not go re-fetch them when they scroll into view.

    Thus once I set InternalList items back to null I have no way of telling loadedIndexes to clear out those indices and these rows will not be reloaded upon scrolling back into view which leaves them as blank rows.

    I don't want to call .Refresh() to get this job done as it causes the grid to flash and would be a huge performance hit.

    I really and I mean REALLY don't want to be forced to use reflection to get at this loadedIndexes member in order to do what I need to do.  Being forced into solutions involving reflection was a primary reason why we moved away from a different control vendor in the past.

    Is there any way around this issue you can recommend, or would you guys consider adding some members that expose the functionality I am looking for?
  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 31 Jan 2013 Link to this post

    Hello,

     I've replied to your other thread.  

    All the best,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready