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

[Solved] Hirerchical RowDetailsTemplate

2 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Prakash
Top achievements
Rank 1
Prakash asked on 20 Oct 2010, 02:56 PM

 

Hi 
  
Please find the attachements
  
From the sample provided, I can achieve One level of Hirerchy using rowdetailstemplate. Please can u give me sample for 
having more than one of level of hirerchy using the same rowdetailstemplate.
  
For Ex:
  
  
<DataTemplate x:Key="ChildRowDetailsTemplate">
<telerik:RadGridView ItemsSource="{Binding Hobbies}" />
</DataTemplate>
  
<DataTemplate x:Key="RowDetailsTemplate">
<telerik:RadGridView Name="playersGrid"
ItemsSource="{Binding Players}"
AutoGenerateColumns="False"
ShowGroupPanel="False" RowDetailsTemplate="{StaticResource hildRowDetailsTemplate}"
RowDetailsVisibilityChanged="OnRowDetailsVisibilityChanged">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Name" 
DataMemberBinding="{Binding Name}">
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Number" 
DataMemberBinding="{Binding Number}">
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</DataTemplate>
  
  
Here ChildRowDetailsTemplate Datatemplate is referred as static resource for Grid playersGrid. i could get the hirerchical view ...
  
Sample which i worked in the below link
  
Changes done with Player class
  
private List<Hobbies> hobbies; -- Variable
  
public List<Hobbies> Hobbies
{
get
{
if (null == this.hobbies)
{
this.hobbies = new List<Hobbies>();
}
return this.hobbies;
}
  
set
{
if (value != this.hobbies)
{
this.hobbies = value;
this.OnPropertyChanged("Hobbies");
}
}
}
  
Constructor of the Player Grid
  
public Player(string name, int number, Position position, string country)
{
this.name = name;
this.number = number;
this.position = position;
this.country = country;
this.Hobbies = new List<Hobbies>()
{
new Hobbies() { Name = "Pepe Reina", ID = 1},
new Hobbies() { Name = "Steven Gerrard", ID = 2}
};
} 
  
  
These are the changed done ... I adding this Hobbies to the Child ChildRowDetailsTemplate radgridview..

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 21 Oct 2010, 07:27 AM
Hello Prakash,

Basically you need to define another HierarchyChildTemplate that will define the 2nd level of hierarchy.

I have attached a sample application which demonstrates this approach. Hope it helps.


Greetings,
Milan
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
Prakash
Top achievements
Rank 1
answered on 26 Oct 2010, 11:18 AM
How Can i implement

 

clubsGrid.ExpandAllHierarchyItems(); inside the button Click from the sample provided previously in this thread.

Expand All Hierarchy Items will work only when it is added with Hierarchy Child Template?

How can i implement the same using RowDetailsTemplate?

Please provide me the sample for my requirement.
and while loading or expanding rows which has no child items to be displayed toggle button shouldn't be appear.

Tags
GridView
Asked by
Prakash
Top achievements
Rank 1
Answers by
Milan
Telerik team
Prakash
Top achievements
Rank 1
Share this question
or