We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

help with grouped rows

hi all.
in my grid i set a group field, and it's wotking fine.
is it possible when i have only 1 row, not to show it's group, and only when i have more then 1 row, it'l group them?


3 Replies

AD Administrator Syncfusion Team January 23, 2007 03:52 PM UTC

Hi Shachar,

You would have to derive a class from GridGroup. In your derived classes you need to override IsChildVisible.

Something like this:

public override bool IsChildVisible(Element el)
{
if( this != null && this.FilteredRecords != null
&& this.FilteredRecords.Count <= 1 )
return false;
else
return base.IsChildVisible(el);// Otherwise default behavior:
}


Please refer to the attached sample for more details.
GGCHideShowGroup.zip

Best Regards,
Haneef


SS Shachar Shimshon January 29, 2007 02:50 PM UTC

this example is'nt what i'm looking for because it makes all the rows that have only 1 row in there group to disappear.
what i want is that all the rows with more then 1 row inside the group will be grouped and the others, that dont have any "brothes" will be displaed but not in a group.
is it possible?


AD Administrator Syncfusion Team January 31, 2007 11:49 PM UTC

Hi Shachar,

Please try this code snippet in IsChildVisible override method and let me know if you are looking something different.

public override bool IsChildVisible(Element el)
{
if( this != null && this.FilteredRecords != null
&& this.FilteredRecords.Count <= 1 )
{
if( el.Kind == DisplayElementKind.Caption )
{
this.IsExpanded = true;
return false;
}
else if( el is GridRecordsDetails)
return true;
else
return false;
}
else
{
return base.IsChildVisible(el);// Otherwise default behavior:
}
}

Here is a modiifed sample.
GGCHideShowGroup_ae89e3bb.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon