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

Event handler for detecting filtering changed when using GridExcelFilter with GridGroupingControl

Hi,

I am having an issue using the Syncfusion.GridHelperClasses.GridExcelFilter with the Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.

I am using the GridExcelFilter to filter records, but I do not understand which event handler I should subscribe to, in order to detect that the user has filtered the grid.

In the attached example program (GroupingGridWithExcelFilters.zip), the following is done:
  1. The grid is initially populated with 20 records
  2. The filter is used to choose to display only 3 records
  3. There is a handler for the event GridExcelFilter.RecordFiltersItemChanged. When this handler is invoked, I use a debug breakpoint and I see that the GridGroupingControl.Table.FilteredRecords property still has 20 records...the records have NOT been filtered at this point!!
  4. I allow execution to continue, and the user interface has filtered the records so that only 3 records are shown
  5. If I push the button "Press This Button After Filtering", the button Click event handler is invoked. I used a debug breakpoint to see that the GridGroupingControl.Table.FilteredRecords property now has 3 records

So, it appears that the filtering is happening correctly...but I do not have an event (to handle) that is fired at an appropriate time. Obviously, I cannot expect the users to push a button after each time they filter records. This needs to happen automatically, when the filter is applied.

From looking in the support forums, it seems that this same issue was previously reported in June 2013, here:
http://www.syncfusion.com/forums/109631/event-after-filter-e-g-via-gridexcelfilter-is-applied

However, this forum thread does not contain any indication of if/how this issue was resolved.

Can anybody suggest how I should register for an event to detect that the filters have changed?

Regards,
Stephen New

Attachment: GroupingGridWithExcelFilters_3d1cf325.zip

1 Reply

PM Piruthiviraj Malaimelraj Syncfusion Team April 5, 2017 11:41 AM UTC

Hi Stephen, 
 
Thanks for your interest in Syncfusion products. 
 
Currently GridGroupingControl does not have direct events which can be triggered after applied the excel filter. In order to get the filtered records count after excel filter is applied,  CategorizedRecords event can be used. 
 
Code example: 
this.gridGroupingControl1.CategorizedRecords += new TableEventHandler(gridGroupingControl1_CategorizedRecords); 
 
void gridGroupingControl1_CategorizedRecords(object sender, TableEventArgs e) 
{ 
    int filteredRecords = e.Table.FilteredRecords.Count; 
    MessageBox.Show("FilterRecords-Count:" + filteredRecords.ToString()); 
} 
 
Sample link: 
 
Regards, 
Piruthiviraj

Loader.
Live Chat Icon For mobile
Up arrow icon