I am using the VirualQueryableCollectionView for displaying about 10K+ records with the LoadSize of 50 records. I have hooked up the "ItemsLoading
" event with control and then I selectively Load the Data considering the eventArg.StartIndex and LoadSize. And then the RadGridView displays those loaded records.
Each time I get the "ItemsLoading
" event called, I get the "VirtualQueryableCollectionViewItemsLoadingEventArgs
"argument with StartIndex and ItemsCount. So I load the records from database which Correspond to the StartIndex and StartIndex+ItemsCount
So when I begin i recieve event.StartIndex=0 and ItemsCount=50 ==> Load Records from 0 to 0+50
when I scroll down I get event e.StartIndex=50 and ItemsCount=50 ==> Load Records from 50 to 50+50
when I scroll down I get event e.StartIndex=100 and ItemsCount=50 ==> Load Records from 100 to 100+50
... and so on
this works fine when I am scrolling forward.
Here is my problem.
Now with the ScrollMode=Deffered I directly go to the bottom of the list.
it loads the records considering the LoadSize of 50. so I get Last record and 50 records prior to that.
when I start scrolling backwards, I see that the Event gets fired very often than when I was scrolling upwards. After I analyzed the EventArgument values It seemed that, "VirtualQueryableCollectionView
" thinks that its startIndex is some X
Value and then I need to Load that X
+ the LoadSize, Because I do not know the Scroll Direction I am always loading records in a range from the StartIndex (coming from EventArgument) + LoadSize(50) in my case.
This results into too many requests while scrolling UP.
Is there a way to find out the scroll direction, so that I cam make better decision about which Items to Load ?
OR is there any other means to resolve this issue ?