Hierarchy Child Grid Expand/Collapse issue

5 posts, 1 answers
  1. Arman
    Arman avatar
    4 posts
    Member since:
    Jul 2013

    Posted 24 Jul 2013 Link to this post

    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.

  2. Answer
    Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 25 Jul 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Arman
    Arman avatar
    4 posts
    Member since:
    Jul 2013

    Posted 25 Jul 2013 Link to this post

    Hello Yordanka,

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

    Thanks a lot.
    Arman.
  5. Krithiga
    Krithiga avatar
    4 posts
    Member since:
    Aug 2014

    Posted 24 Mar Link to this post

    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

  6. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 28 Mar Link to this post

    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.
Back to Top
DevCraft banner