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

VirtualQueryableCollectionView - Determining if Item is Loaded

5 Answers 110 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
Naresh
Top achievements
Rank 1
Naresh asked on 04 Aug 2011, 04:03 PM
Hello,

I need a way to determine if an item has already been loaded into a VQCV. I have tried using Contains but it always returns false. I have also tried the following which returns a "source is not IEnumerable" error:

// State
if (candidate.StateID.HasValue && m_States.AsQueryable().OfType<State>().Where(s => s.StateID == candidate.StateID.Value).Count() < 1)
   SharedContext.Context.Load(SharedContext.Context.GetStateByIDQuery(candidate.StateID.Value), OnStatesLoaded, true);
else
   isStateLoaded = true;

Is there a way to determine if an item is already in a VQCV without resorting to a ForEach loop?

The scenario I'm trying to solve is this. The user navigates to a grid, selects a row and clicks an Edit button. The Edit button launches a child window containing several RadComboBoxes backed by a VQCV. I need to determine if an item as been loaded in the VQCV so that the item shows up in the RadComboBox for the user to see. For example, one of the RadComboBoxes contains States. If this is the first time the user has opened the edit child window, the states will not be loaded yet. Therefore I must load the state so that the user will see "Alabama" in the RadComboBox. 

If there is a better technique than manually searching for the state and then loading it if needed please let me know.

Update: I see from this thread that I'm not the only one fighting this battle: http://www.telerik.com/community/forums/silverlight/data-virtualization/initialize-value-for-the-radcombobox-with-load-in-demand-feature.aspx

I guess it's time to look for alternative solutions.

Thank you,
Brian

5 Answers, 1 is accepted

Sort by
0
Jiti
Top achievements
Rank 1
answered on 06 Dec 2012, 03:12 PM
Hi,

I am using a VQCV to hold the nodes of a RadTreeView control. I need a way to check if a given node is already loaded in the VQCV. 
Are there any updates for the question below:
Is there a way to determine if an item is already in a VQCV without resorting to a ForEach loop? 


Thanks,
Jiti
0
Vlad
Telerik team
answered on 06 Dec 2012, 03:23 PM
Hi,

 If particular item is not null or not dynamic type this item is loaded. 

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jiti
Top achievements
Rank 1
answered on 06 Dec 2012, 04:03 PM
Hi,

I am using virtual load. So my scenario is: If a node has 100 child nodes but the virtual load size is 25, when a scroll is done to load the next 10, I need to know which nodes were already loaded and which were not. How can I customize the VQCV.contains method? The one on the API only takes a node... I want to compare just a property on the node.

Thanks,
Jiti
0
Vlad
Telerik team
answered on 07 Dec 2012, 07:35 AM
Hello,

 What is the problem to compare desired properties if you already have the item/node?

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jiti
Top achievements
Rank 1
answered on 07 Dec 2012, 02:43 PM
I do not have a node... I just have a property on the node. I solved this by creating a dummy node with the property that I had and then overloading the == operator on the node class. So then the VQCV.Contains method would use my custom behavior to find a matching node. If found, I know that the node has been loaded. This solved my problem.

It would be easier if the VQCV Contains method supported lambda expressions.

Thanks for the quick replies.
Jiti
Tags
Data Virtualization
Asked by
Naresh
Top achievements
Rank 1
Answers by
Jiti
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or