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

recursive loading data when scrolling (virtualCollection)

10 Answers 237 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
nidhal ben hamadou
Top achievements
Rank 1
nidhal ben hamadou asked on 13 Mar 2015, 10:04 AM
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);
               }
  
           }
       }



10 Answers, 1 is accepted

Sort by
0
nidhal ben hamadou
Top achievements
Rank 1
answered on 17 Mar 2015, 09:58 AM
hi ,
Any reply please for this exception
0
Dimitrina
Telerik team
answered on 17 Mar 2015, 11:51 AM
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.

 
0
nidhal ben hamadou
Top achievements
Rank 1
answered on 23 Mar 2015, 01:48 PM
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
0
Dimitrina
Telerik team
answered on 25 Mar 2015, 12:36 PM
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.

 
0
nidhal ben hamadou
Top achievements
Rank 1
answered on 26 Mar 2015, 10:10 AM
hi ,
same problem when i do gridView.SelectAll();
it repeat the load process of all the data several times
0
Dimitrina
Telerik team
answered on 26 Mar 2015, 11:34 AM
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.

 
0
nidhal ben hamadou
Top achievements
Rank 1
answered on 30 Mar 2015, 08:54 AM
hi, 
What is the solution for the first problem ,it's a bug in VirtualCollection or what exactly ?
Thank you for your reply :)
0
Dimitrina
Telerik team
answered on 30 Mar 2015, 08:54 AM
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.

 
0
nidhal ben hamadou
Top achievements
Rank 1
answered on 11 Oct 2015, 03:15 PM
any correction of this bug in new version ?? i want to use SelectionMode="Extended" please help .
0
Maya
Telerik team
answered on 14 Oct 2015, 08:27 AM
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
Tags
Data Virtualization
Asked by
nidhal ben hamadou
Top achievements
Rank 1
Answers by
nidhal ben hamadou
Top achievements
Rank 1
Dimitrina
Telerik team
Maya
Telerik team
Share this question
or