I'm using your new VirtualQueryableCollectionView (Q3 SP1 beta) with RadGridView for SL.
I notice that when the scrollbar's thumb is dragged the ItemsLoading callback is called twice.
When the PageDown key is hit or the scrollbar is clicked or the mouse wheel is actuated the ItemsLoading callback is called once as expected.
I set the grid's IsBusy=true at the beginning of the ItemsLoading callback and IsBusy=false just before it returns.
So when the thumb is dragged the grid is busy, then not busy and then busy again until the data appears.
Also the thumb action isn't smooth.
5 Answers, 1 is accepted
Generally ItemsLoading will be raised multiple times if more than LoadSize data are needed. For example if you bind to a ListBox with 25 visible items on the screen and LoadSize is set to 10 you will get three calls for ItemsLoading.Greetings,
the Telerik team
Vlad you're right if the load size is less than the number of items normally displayed in a view then the LoadingItems callback is called twice -even if one uses the keyboard or mouse to page down. However, in my case the load size was set to 5X times the number items required to populate the current view. Also I did an experiment where I set the load size to exactly the number of rows displayed in the grid and did a page down using either the keyboard or the mouse and the ItemsLoading callback was called only once. However, using the same load size, if I drag the scrollbar thumb the callback is called three times.
1. The speed of the cursor doesn't have any affect on this behavior.
2. The grid's DataLoadMode is the default.
I mentioned the behavior of the IsBusy indicator in my first post but more importantly this incorrect response to the drag op impacts performance.
however, it will still be called twice for the topmost items when the RadGridView is initially loaded. but for the rest of the items it will not be called twice. hope this helps.
For the benefit of anyone who come across this thread. I have been running into the issue of the ItemsLoading Event being called twice for the topmost items. Originally my code would call to the server twice via a web service to get the items requested. The SQL that I was running on the server was placing a high load on it and making two requests at the same time doubled the run time of the SQL (e.g. 12 seconds instead of 6 seconds).
To fix this the ItemsLoading Event is received twice. One call is made to the server and when complete, VirtualDataSource.Load is called twice. If VirtualDataSource.Load is not called twice sometimes the scroll bar would not represent the true size of the available items.
The detection of the double load is done by one list tracking what is being loaded. When the ItemsLoading Event fires the second time, A check is done to see if the request is on the first tracking list. If it is on that list, the request is added to another tracking list indicating that it is a double load and the server is not called. In the call back from the server, VirtualDataSource.Load is called once and t request removed from the first tracking list. Then a check is done to see if the request is on the second tracking list indicating a double load. If present there VirtualDataSource.Load is called again.
Thank you for sharing your valuable input to the community.