Expand all rows which has childgrid in radgridview.

10 posts, 0 answers
  1. Swati
    Swati avatar
    4 posts
    Member since:
    Aug 2011

    Posted 10 Aug 2011 Link to this post

    Hi,

    I am working on WPF.\ and we are using telerik controls in our project.

    we are implementing Expand all rows functionalaity in Telerik radgridview . In our radgridview few rows has childgrid and if we are using expandallhierarchyitems() method then it is expanding all rows. My requirment is when i click on expand all button then it shoud expand only those rows which have child grid control.

  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 10 Aug 2011 Link to this post

    Hi Swati,

     
    Have you checked this demo "SelfReference Hierarchy"?


    Kind regards,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Swati
    Swati avatar
    4 posts
    Member since:
    Aug 2011

    Posted 10 Aug 2011 Link to this post

    Hi Vanya,

    i cant check that demo bcoz it is asking me for install Microsoft Silverlight Plugin.
     I will explain my requirment in details.

    Suppose my radgrid has 10 rows and only 4 rows childgrid has valu. there is one button expand all and when i clickd on expand all button then only 4 rows childgrid should be display remaining 6 rows should be collaped.

  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 10 Aug 2011 Link to this post

    Hi Swati,

     
    Actually you do not need Silverlight Plugin, because you are developing in WPF. If you have installed RadControls/WPF you may run Telerik WPF Examples demos locally. Furthermore you may also use the following link http://demos.telerik.com/wpf/. After installing it just find the demo SelfReference-Hirarchy in RadGridView's demos. 
    I believe that such case of hierarchy would be the most appropriate in your case.


    Best wishes,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  6. Swati
    Swati avatar
    4 posts
    Member since:
    Aug 2011

    Posted 10 Aug 2011 Link to this post

    Hi Vanya,
    Thanks for your reply but my requirment is different.
    In your example there is a "+" sign before all  rows whose child grid has values.
    but my requirment is There is only one button "Expand All Rows" and when i click on that button then only those rows which child grid contains value should be expand at a time means we no need to click on "+" sign of each row to expand that row.
  7. Andrei
    Andrei avatar
    3 posts
    Member since:
    Jan 2014

    Posted 12 Jun 2015 Link to this post

    Hi,

    I have a problem i want to bind a hierahically class to a radgrid view, and i want the Workgroup items to show only the Workgroupname and fot the User items to show First Name, View, Edit properties.

    public class User
        {
            public int Id
            {
                get;
                set;
            }
            
            public string FirstName
            {
                get;
                set;
            }

            public string LastName
            {
                get;
                set;
            }

            public bool View
            {
                get;
                set;
            }

            public bool Edit
            {
                get;
                set;
            }

     

    public class Workgroup
        {
            public int Id
            {
                get;
                set;
            }
            public string WorkgroupName
            {
                get;
                set;
            }

            public ObservableCollection<Workgroup> Workgroups
            {
                get;
                set;
            }

            public ObservableCollection<User> Users
            {
                get;
                set;
            }


        }

     

     

    <Window x:Class="WpfApplication2.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
            xmlns:telerik1="http://schemas.telerik.com/2008/xaml/presentation"
            Title="MainWindow" Height="350" Width="525">
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.Resources>
                <Style TargetType="telerik:RadGridView">
                    <Setter Property="ShowGroupPanel" Value="False"/>
                </Style>
                
            </Grid.Resources>
            <telerik:RadGridView x:Name="WorkgroupHierarchicalGridView" AutoGenerateColumns="False" DataLoading="WorkgroupHierarchicalGridView_DataLoading" ShowGroupPanel ="False">
                <telerik:RadGridView.ChildTableDefinitions>
                    <telerik:GridViewTableDefinition>
                        <telerik:GridViewTableDefinition.Relation>
                            <telerik1:PropertyRelation ParentPropertyName="Workgroups" />
                        </telerik:GridViewTableDefinition.Relation>
                    </telerik:GridViewTableDefinition>
                    <telerik:GridViewTableDefinition>
                        <telerik:GridViewTableDefinition.Relation>
                            <telerik1:PropertyRelation ParentPropertyName="Users" />
                        </telerik:GridViewTableDefinition.Relation>
                    </telerik:GridViewTableDefinition>
                </telerik:RadGridView.ChildTableDefinitions>
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding WorkgroupName}" Header="Workgroup Name"  />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </Grid>
    </Window>

         public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                this.WorkgroupHierarchicalGridView.ItemsSource = WorkgroupsService.GetWorkGroups();
            }

            private void WorkgroupHierarchicalGridView_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
            {
                var dataControl = (GridViewDataControl)sender;
                if (dataControl.ParentRow != null && dataControl.ChildTableDefinitions.Count == 0)
                {
                    dataControl.ChildTableDefinitions.Add(new GridViewTableDefinition() { Relation = new PropertyRelation("Workgroups") });
                    dataControl.ChildTableDefinitions.Add(new GridViewTableDefinition() { Relation = new PropertyRelation("Users") });
                }
            }
        }



     

  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 15 Jun 2015 Link to this post

    Hello,

    You can apply a RowDetailsTemplateSelector and return different RowDetailsTemlpate base on some condition. 
    Please note you can download a runnable project of the demonstrated example from our online SDK repository here, after navigating to GridView/RowDetailsTemplateSelector. In order to make browsing the examples easier, you can take advantage of the SDK Samples Browser.

    Let me know how this works for you.

    Regards,
    Dimitrina
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  9. Andrei
    Andrei avatar
    3 posts
    Member since:
    Jan 2014

    Posted 16 Jun 2015 in reply to Dimitrina Link to this post

    Hi unfortunately I didn't managed to  implement the RowDetailsTemplate.(Now I'm learning WPF and telerik controls) .

    The radgrid view loads a list of workgroup, that can host other workgroup and users.

    I want the Workgroup to show only the workgroup name and an expander with other workgroups and users.

    For the user i want to show only it's name,edit,view,delete propertis without showing the userId and the expander as it has no children underneath him.

    Thank you.

  10. Andrei
    Andrei avatar
    3 posts
    Member since:
    Jan 2014

    Posted 16 Jun 2015 in reply to Dimitrina Link to this post

    Here is an image.highlighted with red are the things i don't want to be visible.
  11. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 19 Jun 2015 Link to this post

    Hello,

    You can manually define columns or in case the columns are auto-generated you can subscribe for the AutoGeneratingColumn event and cancel column generation if it should not be displayed.

    As to not displaying an expand column for rows which does not have child data, you can check the Custom Hierarchy WPF Demos. You can also refer to the documentation on RadGridView.

    Regards,
    Dimitrina
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready