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

[Solved] Collapse all for a hierarchical grid

3 Answers 143 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonny
Top achievements
Rank 1
Jonny asked on 24 Aug 2009, 12:15 PM
I'm using a hierarchical grid, with a toolbar that contains a 'Collapse All' button.  I've implemented Collapse All as follows :

ExpandAll(

this.radGridViewRepairs.Records, false);

 


where ExpandAll is defined as :

 

/// <summary>

 

 

/// Expands all records

 

 

/// </summary>

 

 

public void ExpandAll(IList<Record> records, bool bExpand)

 

{

 

  foreach (Record rec in records)

 

  {

 

    if (rec is ExpandableDataRecord)

 

        (rec

as ExpandableDataRecord).IsExpanded = bExpand;

 

 

    else if (rec is GroupRecord)

 

        ExpandAll((rec

as GroupRecord).Records, bExpand);

 

  }

}

This worked fine in a previous trial version, but now I'm using a full release version (Q2 2009) it only collapses the first few records (it looks like just those that were physically on the screen when the grid was expanded).  You can click it multiple times, and it collapses a few more each time.

How can I get this working, so it collapses all expanded rows?

Thanks,

Ben
BlueHub

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 24 Aug 2009, 01:15 PM
Hi Ben,

This is known issue in Q2 but we have recently released Q2 2009 SP1 which introduces several new methods that deal with expansion and collapse of hierarchy grids. To expand all rows you can use RadGridView.ExpandAllHierarchyItems() or to collapse all rows you can use RadGridView.CollapseAllHierarchyItems().

Hope this helps.

Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jonny
Top achievements
Rank 1
answered on 27 Aug 2009, 03:00 PM
Thanks,

Ben.
0
Krishna Kishor Bhat
Top achievements
Rank 1
answered on 27 Oct 2009, 04:40 AM
Hi,

I getting error while trying to implement the expand all/ collapse all functionality for the Hierarchical Grids. Error description is
{System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.RadNavigationButton.RadNavigationButton_Click(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandler.Invoke(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)}
I m using the Q2 2009 SP1 Version 2009.2.812.1030






Thanks,
Krishna Bhat
Tags
GridView
Asked by
Jonny
Top achievements
Rank 1
Answers by
Milan
Telerik team
Jonny
Top achievements
Rank 1
Krishna Kishor Bhat
Top achievements
Rank 1
Share this question
or