recursive loading data when scrolling (virtualCollection)

11 posts, 0 answers
  1. nidhal ben hamadou
    nidhal ben hamadou avatar
    11 posts
    Member since:
    Oct 2009

    Posted 13 Mar 2015 Link to this post

    Hi,
    I use a VirtualCollection binded to a RadGridView (Version 2015.1.225.45    framework 4.5.1 ) 
    My scenario is : when i click on the button move last  VirtualCollectionPays.MoveCurrentToLast(); the scrollbar of gridview move to last position and when i click on the button move fist  VirtualCollectionPays.MoveCurrentToFirst(); the scrollbar of gridview move to fist position .

    Error :  when i move to the last and come back to first position the loading event in virtual collection make a recursive call and load all Items in the database .
    I use a plain wcf services  not rest nether data services .
    i use an async methode in the loading event .

    public async void LoadData()
           {
               VirtualCollectionPays = new VirtualQueryableCollectionViewExtended<Pay>() { LoadSize = SizePage };
               VirtualCollectionPays.ItemsLoading += VirtualCollectionPays_ItemsLoading;
                
               PayDataPage datapager = null;
                 
               var slowTask = Task.Run(() =>
               {
                   datapager = _dataProvider.GetQueryableLazyPay(SizePage, position, PayFilterDescriptor, PaySortDescriptor, PayGroupDescriptor);
               });
      
               await slowTask;
      
               VirtualCollectionPays.VirtualItemCount = datapager.TotalCount;
               VirtualCollectionPays.Load(0, datapager.DataItems);
           }

    // ItemsLoading 
    async void VirtualCollectionPays_ItemsLoading(object sender, VirtualQueryableCollectionViewItemsLoadingEventArgs e)
            {
                   
                BusyIndicatorGrid = true;
                try
                {
                    PayDataPage datapager = null;
                    ItemsLoading = Task.Run(() =>
                    {
                        datapager = _dataProvider.GetQueryableLazyPay(SizePage, e.StartIndex, PayFilterDescriptor, PaySortDescriptor, PayGroupDescriptor);
                    });
       
                    await ItemsLoading;
                       
                    VirtualCollectionPays.Load(e.StartIndex, datapager.DataItems);
                       
                    BusyIndicatorGrid = false;
                }
                catch (Exception ex)
                {
                    string mg = ex.Message;
                }
       
            }


    when selected change of gridView the scrollbar change position 

    void radGridViewPay_SelectionChanged(object sender, SelectionChangeEventArgs e)
           {
               var VMListePay = this.DataContext as VMListePay;
               radGridViewPay.ScrollIndexIntoView(VMListePay.VirtualCollectionPays.CurrentPosition);
             
           }


    same problem when i change SelectionChanged (radGridView) with PropertyChanged (VirtualCollection)

    void VirtualCollectionPays_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
           {
               var VMListePay = this.DataContext as VMListePay;
               if (e.PropertyName == "CurrentPosition")
               {
                   if (VMListePay.VirtualCollectionPays.CurrentPosition >= 0)
                   {
                       radGridViewPay.ScrollIndexIntoView(VMListePay.VirtualCollectionPays.CurrentPosition);
                   }
      
               }
           }



  2. nidhal ben hamadou
    nidhal ben hamadou avatar
    11 posts
    Member since:
    Oct 2009

    Posted 17 Mar 2015 in reply to nidhal ben hamadou Link to this post

    hi ,
    Any reply please for this exception
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 Mar 2015 Link to this post

    Hi,

    This seems to be incorporated with the design of the virtual collection as when you scroll upwards there may be less items needed to be loaded, for example in some cases - only 1. The virtual collection is designed like so in order to have smooth scrolling performance and ensure all requested items are actually loaded into view. 
    In case you believe this can be improved, would it be possible for you to isolate the exact case in a demo project illustrating it? You can take a look at this blog post for a reference on how to isolate an issue. That way I can debug it with the source code to confirm whether we may consider it as a bug. 

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. nidhal ben hamadou
    nidhal ben hamadou avatar
    11 posts
    Member since:
    Oct 2009

    Posted 23 Mar 2015 in reply to Dimitrina Link to this post

    hi ,
    when i move to the last and come back to first position the loading event in virtual collection make a recursive call and load all Items in the database .
    I use a plain wcf services  not rest nether data services but i simulated it with the function GetPays.

    I can't attach project so here is the link :
    https://drive.google.com/file/d/0B_U5cj9rv7d0cy1wc2VibWZTYmM/view?usp=sharing
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 25 Mar 2015 Link to this post

    Hi,

    Thank you for isolating the problem in a sample project. I was able to reproduce the issue and I am going to investigate the case further.

    Regards,
    Dimitrina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  7. nidhal ben hamadou
    nidhal ben hamadou avatar
    11 posts
    Member since:
    Oct 2009

    Posted 26 Mar 2015 in reply to Dimitrina Link to this post

    hi ,
    same problem when i do gridView.SelectAll();
    it repeat the load process of all the data several times
  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Mar 2015 Link to this post

    Hello,

    Thank you for pointing this out. I should mention the multiple/extended selection with VirtualQueryableCollectionView is only recommended when the selected items are in the View area. It is not possible to actually select items outside it as the items to be eventually displayed are still not presented. You can find a feedback item on the matter on our Feedback portal here.

    Regards,
    Dimitrina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  9. nidhal ben hamadou
    nidhal ben hamadou avatar
    11 posts
    Member since:
    Oct 2009

    Posted 30 Mar 2015 in reply to Dimitrina Link to this post

    hi, 
    What is the solution for the first problem ,it's a bug in VirtualCollection or what exactly ?
    Thank you for your reply :)
  10. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 30 Mar 2015 Link to this post

    Hello,

    I debugged the solution further with the source codes directly and as it turns out this problem occurs only when you have configured RadGridView with SelectionMode="Extended".  My suggestion would be to keep the default single selection mode.

    Regards,
    Dimitrina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  11. nidhal ben hamadou
    nidhal ben hamadou avatar
    11 posts
    Member since:
    Oct 2009

    Posted 11 Oct 2015 in reply to Dimitrina Link to this post

    any correction of this bug in new version ?? i want to use SelectionMode="Extended" please help .
  12. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 14 Oct 2015 Link to this post

    Hi Nidhal,

    We declined the item with an explanation written in the corresponding issue in the portal. Please take a look at it - "Cannot extended select all the items when GridView is bound to VirtualQueryableCollectionView"



    Regards,
    Maya
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready