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.
Unfortunately, activation email could not send to your email. Please try again.

Filter on value of Group quantity

Thread ID:

Created:

Updated:

Platform:

Replies:

130880 Jun 8,2017 07:17 AM Jun 9,2017 07:51 AM Windows Forms 1
loading
Tags: GridGroupingControl
Pierre Smith
Asked On June 8, 2017 07:17 AM

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

Arulpriya Ramalingam [Syncfusion]
Replied On June 9, 2017 07:51 AM

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;