CollapseAllHierarchyItems Sets row IsExpandable to true

4 posts, 0 answers
  1. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 15 Jul 2013 Link to this post

    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();

  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 18 Jul 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Ars
    Ars avatar
    7 posts
    Member since:
    Aug 2011

    Posted 03 Mar 2014 in reply to Nick Link to this post

    Hi, Nik

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



    which exact method I should to override? 

    Thank you

  5. Nick
    Admin
    Nick avatar
    593 posts

    Posted 06 Mar 2014 Link to this post

    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!

Back to Top