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

Expand all rows which has childgrid in radgridview.

9 Answers 444 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Swati
Top achievements
Rank 1
Swati asked on 10 Aug 2011, 12:11 PM

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.

9 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 10 Aug 2011, 12:37 PM
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 >>

0
Swati
Top achievements
Rank 1
answered on 10 Aug 2011, 12:44 PM
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.

0
Vanya Pavlova
Telerik team
answered on 10 Aug 2011, 01:01 PM
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 >>

0
Swati
Top achievements
Rank 1
answered on 10 Aug 2011, 01:36 PM
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.
0
Andrei
Top achievements
Rank 1
answered on 12 Jun 2015, 01:05 PM

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") });
            }
        }
    }



 

0
Dimitrina
Telerik team
answered on 15 Jun 2015, 01:27 PM
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
0
Andrei
Top achievements
Rank 1
answered on 16 Jun 2015, 01:32 PM

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.

0
Andrei
Top achievements
Rank 1
answered on 16 Jun 2015, 01:34 PM
Here is an image.highlighted with red are the things i don't want to be visible.
0
Dimitrina
Telerik team
answered on 19 Jun 2015, 10:56 AM
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
Tags
General Discussions
Asked by
Swati
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Swati
Top achievements
Rank 1
Andrei
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or