Load Animation for Empty Nodes

6 posts, 0 answers
  1. Vit100
    Vit100 avatar
    66 posts
    Member since:
    Oct 2012

    Posted 02 Jun 2010 Link to this post

    I have Model:

     public class DataModel  
        {  
            Web.Services.CSISContext context;  
     
            public ObservableCollection<Site> Sites { get; set; }    //Site has list of Contracts
            public ObservableCollection<Contract> Contracts { get; set; }  
     
     
     public void LoadContracts(Site site)  
            {  //psevdo code. In real life it gets data from DB or WCF service...
                if (site==Site1)
                    site.add(contract1);
                    site.add(contract2);
                if(site==site3)
                   site.add(contract100);
             }   
                
                
                
              
               
     

     

     

     

    Site1
        Contract1
        Contract2
    Site2
    Site3
        Contract100

    Site 2 doens't have any contracts (database or WCF service returns empty collection).

    Tree is working OK if I click Site1 or Site3 - load on demand populates Contracts and they are shown in corresponding nodes.
    If I click Site2 - tree shows loadOnDemand animation even after Database query is over. Why Animation is not hidden after database return empty collection - means no childred for Site2?.

  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 03 Jun 2010 Link to this post

    Hello Vit100,

    Because it doesn't know when to stop!

    Please check this help article to see what should be done when there are no items:
    http://www.telerik.com/help/silverlight/radtreeview-features-load-on-demand.html

    In short:

    When there are no items to add, and you want to stop the loading animation, set the IsLoadingOnDemand property to False to the RadTreeViewItem that has fired the LoadOnDemand event. 

    When there are no items to add, and you want to prevent the LoadOnDemand event to fire again, set the IsLoadOnDemandEnabled property to False to the RadTreeViewItem that has fired the LoadOnDemand event.

    Please let us know if you have any issues.

    Sincerely yours,
    Valentin.Stoychev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  3. Vit100
    Vit100 avatar
    66 posts
    Member since:
    Oct 2012

    Posted 03 Jun 2010 Link to this post

    Problem is that GUI is binded to data model and data model doesn't know anything abt GUI and properties of GUI, like IsLoadOnDemandEnabled.
    Second thing that at one period of time Site2 doesn't have children, at another time (during same page life) Site2 node have children - it depends on data model. So I can not just set IsLoadOnDeamndEnabled=false...
  4. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 04 Jun 2010 Link to this post

    Hi Vit100,

    Yes - but only the developer "knows" when the web service has finished loading right? The treeview do not have this knowledge. In your case you can use the telerik container binding and bind the IsLoadOnDemandEnabled property to a property in your busines object, which you can set when the service has finished loading.

    Please let us know how it goes.

    Sincerely yours,
    Valentin.Stoychev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  5. Vit100
    Vit100 avatar
    66 posts
    Member since:
    Oct 2012

    Posted 01 Sep 2010 Link to this post

    Can you pls give more details...

    "you can use the telerik container binding and bind the IsLoadOnDemandEnabled property to a property in your busines object, which you can set when the service has finished loading."

    Any sample project??
    I can prepare sample as template...
  6. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 06 Sep 2010 Link to this post

    Hi Vit100,

    You can take a look at following example. I've attached a project demonstrating how to implement the solution suggested by my colleague. I'm using container binding to bind the IsLoadOndemand and LoadingOnDemand properties of RadTreeViewItem to appropriate properties in my view model. You can take a look at items 2 and 5 to see how I'm changing the load on demand properties in runtime.

    Please let us know if you need more info.

    Best wishes,
    Hristo Milyakov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top