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

CollapseAllHierarchyItems Sets row IsExpandable to true

3 Answers 21 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sintayehu
Top achievements
Rank 1
Sintayehu asked on 15 Jul 2013, 05:21 PM
Hi,

I have a Hierarchical grid (2 level deep). Just introduced a way to collapse all hierarchy by calling

CollapseAllHierarchyItems on the Grid.

Some of the child items are empty so I am using a conditional style selector to collapse the visibility of the expand button where an item is empty.

But upon calling  the collapse all method my conditional style selector is ignored and I see expand buttons even on rows that are empty.

Question:

1 - Why does the grid show expand button if a row has no child item? Only for the user to expand and find out that data is empty. Is there a special flag to say "Make - IsExpandable - False - when data is empty"?

2 - How can I set IsExpandable to false for all rows that have children with empty dat?

<telerik:RadGridView.RowStyleSelector>
                    <telerik:ConditionalStyleSelector>
                        <telerik:StyleRule Condition="somedata = 'A'">
                            <Style TargetType="gridView:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}">
                                <Setter Property="IsExpandable" Value="True" />
                               
                            </Style>
                        </telerik:StyleRule>
                        <telerik:StyleRule Condition="Not someData= 'A'">
                            <Style TargetType="gridView:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}">
                                <Setter Property="IsExpandable" Value="False" />
                            </Style>
                        </telerik:StyleRule>
                    </telerik:ConditionalStyleSelector>
</telerik:RadGridView.RowStyleSelector>

 

TestRadGridView.CollapseAllHierarchyItems();

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 18 Jul 2013, 06:30 AM
Hi Luai,

You can use the override of the method that takes a boolean as a parameter, which keeps the settings if the parameter is true. 

Hope this helps! 

Regards,
Nik
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
Ars
Top achievements
Rank 1
answered on 03 Mar 2014, 07:20 AM
Hi, Nik

[quote]

You can use the override of the method that takes a boolean as a parameter, which keeps the settings if the parameter is true. 
[/quote]

which exact method I should to override? 

Thank you

0
Nick
Telerik team
answered on 06 Mar 2014, 08:55 AM
Hi ,

You just need to call Collapse/ExpandAllHierarchyItems with a parameter true to preserve the IsExpandable property value. 

Hope this helps! 

Regards,
Nik
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

Tags
GridView
Asked by
Sintayehu
Top achievements
Rank 1
Answers by
Nick
Telerik team
Ars
Top achievements
Rank 1
Share this question
or