I am using Telerik TreeListView (from Q2 2010) to display hierarchical data. It has few columns also.
The tree is populated with three levels of data. While expanding and collapsing the node/row, it takes long time.
So I would like to display some wait control to notify the user that the tree is processing something.
But I am not able to find any such events fired from the TreeListView control
It makes more sense to have such events. So please let me know how I can acheive this.
I desperately in need of a solution for this issue.
Thanks in advance.
-Siraj.
9 Answers, 1 is accepted
After 2010.Q2 we added the RowIsExpandedChanged event, which should suit your needs. You can find it in one of the more recent Internal Builds. This will also land in the SP1 release, which is due this week.
All the best,Yavor Georgiev
the Telerik team
Thanks for your promp response.
Is there any event just before expanding or collapsing? Because I would like to dislay some wait control while the tree is expanding/collapsing.
I tried setting DataLoadMode=Asynchronous. But it crashes the application intermittently. So I am looking for an alternate to this behaviour.
Please suggest me how I can acheive the same.
Thanks,
Siraj.
You can implement the child data retrieval logic in your view model asynchronously and bind some boolean property to the treelistview IsBusy or set directly IsBusy. For example:
public class Customer
{
ObservableCollection<Order> _Orders;
public ObservableCollection<Order> Orders
{
if(_Orders == null)
{
YourViewModel.IsLoading = true;
// your code to retrieve Orders for this customer asynchronously.
}
return _Orders;
}
}
<telerik:RadTreeListView ItemsSource="{Binding Customers}" IsBusy="{Binding IsBusy}" ...
Vlad
the Telerik team
Thanks for your valuable suggestion.
Here my problem is not about data loading. It is about the time delay while expanding/collapsing the tree nodes in the TreeListView.
The data would have been already loaded at this point.
So I would like to notify the user that the tree is processing something when the node is being expanded/collapsed. If I can handle such events, I can set the IsBusy property as you mentioned in your reply. But I am not able to find any such events in that control.
Is there any events whenever we expand / collapse a node in the TreeViewList? Or please let me know if there is any other workaround for this issue.
In my opinion, having events for expanding and collapsing nodes in a tree control, makes more sense.
Thanks,
Siraj.
Based on your input, we have added a RowIsExpandedChanging event on RadTreeListView and RadGridView, which fires before the hierarchy is expanded or collapsed. This gives you the ability to cancel the operation and change the data that is going to be loaded. Also, if you set DataLoadMoade to Asynchronous, and set IsBusy=true in RowIsExpandedChanging and then IsBusy=false in RowIsExpandedChanged, the busy indicator will show up during the data load operation.
I know you said DataLoadMode=Asynchronous crashes your application earlier in the thread, but if you don't set it, the data will be loaded in the UI thread, so even if you set IsBusy to true, the busy indicator won't show, because the thread will be locked during the data load operation.
You can find these new updates in next week's Internal Build.
Yavor Georgiev
the Telerik team
<
telerik:RadTreeListView
x:Name
=
"radTreeListView"
ItemsSource
=
"{Binding TellerServices, Converter={StaticResource assignedServiceConverter}}"
AutoGenerateColumns
=
"False"
IsReadOnly
=
"True"
SelectionUnit
=
"FullRow"
telerik:StyleManager.Theme
=
"Windows7"
Style
=
"{StaticResource DraggableRadTreeListView}"
RowIsExpandedChanged
=
"radTreeListView_RowIsExpandedChanged"
>
<
telerik:RadTreeListView.ChildTableDefinitions
>
<
telerik:TreeListViewTableDefinition
ItemsSource
=
"{Binding Children}"
/>
</
telerik:RadTreeListView.ChildTableDefinitions
>
<
telerik:RadTreeListView.Columns
>
...
</
telerik:RadTreeListView.Columns
>
</
telerik:RadTreeListView
>
The problem is that the RowIsExpandedChanged doesn't fire, no matter what I do.
There were some issues with the initial implementation, which precluded RowIsExpandedChanged from firing on RadTreeListView under certain scenarios. Could you please try with our Latest Internal Build, where this issue is resolved?
Kind regards,Yavor Georgiev
the Telerik team
Trial users get to sample all the perks our customers enjoy, including access to internal releases. Please check your account page. You will be able to find the fix I mentioned in the trial internal build that is scheduled to be released tomorrow.
Kind regards,Yavor Georgiev
the Telerik team