How to Synchronize Hide Columns of Hierarchy GridView and Parent GridView

1 Answer 68 Views
GridView
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Psyduck asked on 25 Jan 2022, 07:43 AM

Hello.

Same gridview exists in RowDetails in GridView.

I want to hide columns at the same time.
I applied the hide/show column function in the parent gridview right from the sdk example.

However, it is difficult to apply in row details.

I tested it in a slightly different way, but it didn't work.

How should I approach it?
Width column synchronization was also applied to make visible similarly, but it failed.

Thanks.

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 27 Jan 2022, 09:36 AM

Hello KIM,

The Column collections of the parent GridView and the one in the row details are not automatically synchronized. In order to achieve your requirement, you will need to implement this manually. One way to do so is to data bind the IsVisible properties of the columns of the GridView in the row details to the columns of the parent GridView. Here is how a child column could look like:

	<telerik:GridViewDataColumn Header="GpA" DataMemberBinding="{Binding GpA}" Width="{Binding Column1, Mode=TwoWay, Source={StaticResource ColumnSync}}"
															IsVisible="{Binding RelativeSource={RelativeSource AncestorType=telerik:GridViewRow}, Path=GridViewDataControl.Columns[GpA].IsVisible}"/>

I've updated your project to show this approach. I hope it helps.  

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Martin Ivanov
Telerik team
Share this question
or