VirtualQueryableCollectionView - Determining if Item is Loaded

6 posts, 0 answers
  1. Naresh
    Naresh avatar
    31 posts
    Member since:
    Mar 2009

    Posted 04 Aug 2011 Link to this post

    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
  2. Jiti
    Jiti avatar
    12 posts
    Member since:
    Jul 2012

    Posted 06 Dec 2012 Link to this post

    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
  3. DevCraft banner
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 06 Dec 2012 Link to this post

    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.

  5. Jiti
    Jiti avatar
    12 posts
    Member since:
    Jul 2012

    Posted 06 Dec 2012 Link to this post

    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
  6. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 07 Dec 2012 Link to this post

    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.

  7. Jiti
    Jiti avatar
    12 posts
    Member since:
    Jul 2012

    Posted 07 Dec 2012 Link to this post

    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
Back to Top
DevCraft banner