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
close icon

Filter on value of Group quantity

I have this situation where if I group my records lets say according to the date I want to be able to filter all of the transactions that are higher than a specific amount in the group
So lets say when I group it I have a group of 10 and a group of 20 items how can I show only the group that have more than 10 items

Hope someone can help me with this

1 Reply

AR Arulpriya Ramalingam Syncfusion Team June 9, 2017 11:51 AM UTC

Hi Pierre, 
 
Thanks for your interest in Syncfusion products. 
 
Query 
Response 
how can I show only the group that have more than 10 items 
Suggestion 1 
 
In order to display the groups based on their grouped items count, the QueryRecordMeetsFilterCriteria event can be used. In that event, the GetChildCount() method can be used to get the grouped items count and e.Result property used to display/hide groups. Please make use of below code and sample, 
 
//Event Triggering 
this.gridGroupingControl1.QueryRecordMeetsFilterCriteria += GridGroupingControl1_QueryRecordMeetsFilterCriteria; 
 
//Event Customization 
private void GridGroupingControl1_QueryRecordMeetsFilterCriteria(object sender, Syncfusion.Grouping.QueryRecordMeetsFilterCriteriaEventArgs e) 
{ 
     if (this.gridGroupingControl1.TableDescriptor.GroupedColumns.Count > 0) 
     { 
         //To display the grouped items based on grouped items count 
         if (e.Record.ParentGroup.GetChildCount() > 10) 
             e.Result = true; 
         else 
             e.Result = false; 
 
         e.Handled = true; 
     } 
} 
 
Suggestion 2 
 
You can also create a custom GroupingEngine and override the IsGroupVisible() property to display the groups based on the items count. Please make use of below code and sample, 
 
public class GroupingTable : GridGroup 
{ 
    public GroupingTable(Section parent) 
        : base(parent) 
    { 
    } 
    //Overridden to display the grouped items which are greater than 10 
    protected override bool IsGroupVisible() 
    { 
        //To get the grouped items count 
        if (GetFilteredRecordCount() > 10) 
            return true; 
        else 
            return false; 
    } 
} 
 
Sample links 
 
Regards, 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon