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

VirtualQueryableCollectionView CurrentItem not loaded

3 Answers 72 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
jura
Top achievements
Rank 1
jura asked on 19 Aug 2015, 01:15 PM

While using RadGridView with VirtualQueryableCollectionView and moving CurrentPosition with any of MoveCurrent* methods, I have found, that CurrentItem is not loaded when CurrentPosition changes to an index of not yet loaded item (in my case LoadSize is 50 and items are loaded from our WCF service) and thus CurrentItem is null.
The problem is in QueryableCollectionView.InternalGetItemAt where

return this.InternalList[index];

ignores items loading.

 

My fix for now is:

public class VirtualQueryableCollectionView<T> :
        Telerik.Windows.Data.VirtualQueryableCollectionView<T>
    {
        protected override void OnCurrentChanged(EventArgs args)
        {
            // fix not loaded CurrentItem is not loaded when CurrentPosition changes
            if (
                !IsCurrentBeforeFirst &&
                !IsCurrentAfterLast &&
                CurrentItem == null
                )
            {
                SetCurrent(GetItemAt(CurrentPosition), CurrentPosition);
            }
            base.OnCurrentChanged(args);
        }
    }

It has a drawback that OnCurrentChanged is called twice when this fix is effective.

3 Answers, 1 is accepted

Sort by
0
jura
Top achievements
Rank 1
answered on 19 Aug 2015, 01:17 PM
I forgot to mention that I am Marek Ištvánek using Jura`s account ;-)
0
Dimitrina
Telerik team
answered on 24 Aug 2015, 05:38 AM
Hi,

You are indeed right. The MoveCurrent methods are not respected by VirtualQueryableCollectionView.

In order to get better overview on what the progress of this issue is, I would suggest you to submit it on the Feedback Portal. You can also refer to the details posted at the end of this reply. That way you may follow the item and get notified when there is a change in the status of the report. 

Thank you for sharing the workaround you came up with the community.

Regards,
Dimitrina
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
0
jura
Top achievements
Rank 1
answered on 24 Aug 2015, 07:43 AM

Reported here:
http://feedback.telerik.com/Project/143/Feedback/Details/167237-virtualqueryablecollectionview-currentitem-not-loaded

Marek

Tags
Data Virtualization
Asked by
jura
Top achievements
Rank 1
Answers by
jura
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or