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

Load Animation for Empty Nodes

5 Answers 108 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Vit100
Top achievements
Rank 1
Vit100 asked on 02 Jun 2010, 06:02 PM
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?.

5 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 03 Jun 2010, 09:25 AM
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.
0
Vit100
Top achievements
Rank 1
answered on 03 Jun 2010, 02:08 PM
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...
0
Valentin.Stoychev
Telerik team
answered on 04 Jun 2010, 04:45 PM
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.
0
Vit100
Top achievements
Rank 1
answered on 01 Sep 2010, 02:13 PM
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...
0
Hristo
Telerik team
answered on 06 Sep 2010, 12:02 PM
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
Tags
TreeView
Asked by
Vit100
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Vit100
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or