I have RadGridView incorporating RadGridView.HierarchyChildTemplate . Is that possible to define Data paging for both views, main and hierarchical one (hierarchical - i mean data shown by expanding rows of main view)?
just for info, I'm using view data model rather than code behind.
Thanks,
-Igor.
6 Answers, 1 is accepted
It will be no problem to use RadDataPager in HierarchyChildTemplate together with the child grid.
Greetings,Vlad
the Telerik team
Thanks for the reply. I tried setting up Data Paging for childs but that had no effect on view. I can set data paging for main, parent view w/o issue but not for child ones. Here is my xaml , please see below (i guess the change is xaml driven, right?).
I'm not sure where should i define <telerik:RadDataPager ... . If i define it after </telerik:RadGridView> I got paging in parent/main view. If i do this in other places I get some errors right away.
Thanks again.
/*****************************
<StackPanel>
<telerik:RadGridView x:Name="RadGridView1" IsReadOnly="True" ShowGroupPanel="False" CanUserSortColumns="True" ItemsSource="{Binding somebinding, Mode=TwoWay}" AutoGenerateColumns="False">
<telerik:RadGridView.ChildTableDefinitions>
<telerik:GridViewTableDefinition />
</telerik:RadGridView.ChildTableDefinitions>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding somebinding, Mode=TwoWay}" Width="120" Header=" someheader"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding somebinding, Mode=TwoWay}" Width="40" Header="someheader"/>
…some more columns
</telerik:RadGridView.Columns>
<telerik:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<telerik:RadGridView x:Name="RadGridView2" CanUserFreezeColumns="False" AutoGenerateColumns="False" ItemsSource="{Binding ChildModel, Mode=TwoWay}" IsReadOnly="True">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding somebinding, Mode=TwoWay}" Width="120" Header="someheader"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding somebinding, Mode=TwoWay}" Width="40" Header="someheader "/>
… some more columns
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
</telerik:RadGridView>
</StackPanel>
/***********************************
Here is an example how to define both child grid and pager:
<telerik:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<telerik:RadGridView ItemsSource="{Binding ChildModel}" />
<telerik:RadDataPager Source="{Binding ChildModel}" Grid.Row="1" />
</Grid>
</DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
In this case however ChildModel should be IPagedCollectionView - for example QueryableCollectionView.
I've noticed also that the master grid is inside StackPanel - this control will measure the grid with infinity and you will get serious performance problems (the grid will try to create all rows at once).
Vlad
the Telerik team
Thanks again for the help!. I got paging working for both parent and child grids. However, I have performance issues in case when
there are thousands (like > 10) of rows in child view and I when try to expand that row with so many child’s. At the same time I see that IE memory(on client) is going up till IE eventually stops responding. I put master grid out of StackPanel is you advised. What should I do in order to fix this? I guess I need something that would cause client to display predefined number of rows and holding only limited number of rows in memory on client. Is that possible?
-Igor.
Please define Height for the child grid as well since HierarchyChildTemplate will measure control with infinity as well.
Greetings,Vlad
the Telerik team