Changing filter resets Expanded status in hierirchical DataBoundGrid

When I change filter value in DataBoundGrid it resets Expanded\Collapsed status of child rows. Is there a way to preserve the information ? I tried catching FilterBarTextChanged event and restore it manually, but it appears that grid is reset after the event is fired, so it does not help. Another question: I have a parent\child relation table where not all parents have children. At the moment after initalizing grid I call first ExpandAll() then immediately CollapseAll() method, this way only parent records that have child records have little + sign next to them. Is there any way to automate the process ?

2 Replies

AD Administrator Syncfusion Team October 14, 2004 06:28 AM UTC

Here is forum thread that discusses saving the expand state during a sort. I think you can use a similar techique for the filter. It takes some coding. Both filtering and sorting trigger a ListChanged.Reset event that the grid responds to by resetting the grid which is causing this behavior. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16065 It is a little trickier to find the place to save and restore teh state when you filter than when you sort. But I thnk this derived grid will show you where to do it.
public class MyGridDataBoundGrid : GridDataBoundGrid
{
	protected override void OnCellClick(GridCellClickEventArgs e)
	{
		//Save state here
		base.OnCellClick (e);
	}
	protected override void OnCellButtonClicked(GridCellButtonClickedEventArgs e)
	{
		//Save state here
		base.OnCellButtonClicked (e);
		}
	protected override void OnCurrentCellCloseDropDown(Syncfusion.Windows.Forms.PopupClosedEventArgs e)
	{
		base.OnCurrentCellCloseDropDown (e);
		//restore state here
	}
}
There is no property setting that will control whether you see a + on a parent with no children. But here is a forum thread that discusses how you can handle this. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=8517


AD Administrator Syncfusion Team October 15, 2004 10:58 PM UTC

I found a somewhat workaround solution - attach to DataView event (listchanged) and reset +/- from there. It''s a bit strange that there is no event on "filter done working", may I suggest adding one ? >Here is forum thread that discusses saving the expand state during a sort. I think you can use a similar techique for the filter. It takes some coding. Both filtering and sorting trigger a ListChanged.Reset event that the grid responds to by resetting the grid which is causing this behavior. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16065 > >It is a little trickier to find the place to save and restore teh state when you filter than when you sort. But I thnk this derived grid will show you where to do it. >
>public class MyGridDataBoundGrid : GridDataBoundGrid
>{
>	protected override void OnCellClick(GridCellClickEventArgs e)
>	{
>		//Save state here
>		base.OnCellClick (e);
>	}
>	protected override void OnCellButtonClicked(GridCellButtonClickedEventArgs e)
>	{
>		//Save state here
>		base.OnCellButtonClicked (e);
>		}
>	protected override void OnCurrentCellCloseDropDown(Syncfusion.Windows.Forms.PopupClosedEventArgs e)
>	{
>		base.OnCurrentCellCloseDropDown (e);
>		//restore state here
>	}
>}
>
> >There is no property setting that will control whether you see a + on a parent with no children. But here is a forum thread that discusses how you can handle this. >http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=8517

Loader.
Up arrow icon