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

Hierarchy Child Grid Expand/Collapse issue

4 Answers 677 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.
Arman
Top achievements
Rank 1
Arman asked on 24 Jul 2013, 09:34 PM
Hi telerik team,

I notice one issue related with hierarchy child grid. In my simple project I have telerik grid control and also child grids for each row (set via hierarchy child template property). Steps to see the issue.

Steps:
1. Expand all rows from the beginning of the main grid (step1.jpg).
2. Start collapsing of the rows started from the last one (3 rows are enough) (step2.png)
3. Scroll up to the first row of the main grid (step3.png)

You will see empty space on the top of the main grid (step3.png).
Please tell mi how can I resolve this issue.

Here is the code:

XAML:

<UserControl x:Class="Hierarchy_Child.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"
    xmlns:data="clr-namespace:Hierarchy_Child">
    <UserControl.Resources>
        <data:Data x:Key="Source" />
    </UserControl.Resources>
 
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadGridView DataContext="{StaticResource Source}"
                             ItemsSource="{Binding Requirements}"
                             AutoGenerateColumns="False"
                             >
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding F1}"  />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding F2}" />
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition />
            </telerik:RadGridView.ChildTableDefinitions>
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView
                             ItemsSource="{Binding RequirementsChild}"
                             HorizontalAlignment="Left"
                             Margin="25 0 0 0"
                             AutoGenerateColumns="False"
                             >
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding F3}" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding F4}" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>
        </telerik:RadGridView>
    </Grid>
</UserControl>

C#:

public class RequirementModel
    {
        public int F1 { get; set; }
 
        public int F2 { get; set; }
 
        public List<RequirementChildModel> RequirementsChild { get; set; }
    }
 
    public class RequirementChildModel
    {
        public int F3 { get; set; }
 
        public int F4 { get; set; }
    }
 
    public class Data
    {
        public List<RequirementModel> Requirements { get; set; }
 
        public Data()
        {
            Requirements = new List<RequirementModel>();
            for (int i = 0; i < 10; i++)
            {
                RequirementModel rm = new RequirementModel();
                rm.F1 = 13;
                rm.F2 = 15;
                rm.RequirementsChild = new List<RequirementChildModel>();
                for (int j = 0; j < 4; ++j)
                {
                    rm.RequirementsChild.Add(new RequirementChildModel() { F3 = 17, F4 = 90 });
                }
                Requirements.Add(rm);
            }
        }
    }


Thanks,
Arman.

4 Answers, 1 is accepted

Sort by
0
Accepted
Yordanka
Telerik team
answered on 25 Jul 2013, 05:54 AM
Hello Arman,

Can you set RadGridView.GroupRenderMode="Flat" and let me know if the problem still occurs?
 
Regards,
Yordanka
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Arman
Top achievements
Rank 1
answered on 25 Jul 2013, 03:28 PM
Hello Yordanka,

I added GroupRenderMode="Flat" to the main grid.
Now everything is working fine.

Thanks a lot.
Arman.
0
Krithiga
Top achievements
Rank 1
answered on 24 Mar 2016, 11:42 AM

Hi

 

I am using Hierarchical RadGridView , I need to auto expand all the child grid while loading the parent grid , Instead of clicking the Expand Button, Please let me know how I can achieve this

0
Stefan
Telerik team
answered on 28 Mar 2016, 11:20 AM
Hi Krithiga,

For achieving this, you can use the built-in ExpandAllHierarchyItems() method of RadGridView. Can you please give it a try and let me know how it goes?

Regards,
Stefan X1
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Arman
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Arman
Top achievements
Rank 1
Krithiga
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or