SfDataGrid UI filtering

Hi,

I am using column UI filtering (AllowFiltering = True) with my SfDataGrid. I have the FilterPopupMode set to CheckBoxFilter and have disabled the sort panel (ShowSortPanel = False). When the filter UI is open I can detect its closure by setting a Boolean flag when clicking either the OK or Cancel buttons on the UI. This process enables me to keep the dropdown container that hosts the SfDataGrid open while the filter UI is displayed. This all works perfectly. The issue that I'm trying unsuccessfully to resolve is how to detect the filter UI 'closing' when the mouse is clicked outside of the UI, as doing so closes the UI. I need to ensure my Boolean flag variable is updated to be False when this occurs. The Boolean flag is set to True in the FilterPopupShowing event.

Is there a way to accomplish this?


WinForms 19.2.0.44
Windows 10
VB.Net (VS Studio 2019)


Regards

Jeremy


3 Replies 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team July 19, 2021 10:36 AM UTC

Hi Jeremy, 

Thanks for contacting Syncfusion support.  

You can get notification when the filter popup is closed as shown in the following code example.  

Code example :  

public Form1() 
{ 
    InitializeComponent(); 
    sfDataGrid1.DataSource = new OrderInfoCollection().OrdersListDetails; 
 
    this.sfDataGrid1.FilterPopupShown += SfDataGrid1_FilterPopupShown; 
} 
private void SfDataGrid1_FilterPopupShown(object sender, Syncfusion.WinForms.DataGrid.Events.FilterPopupShownEventArgs e) 
{ 
    var toolstrip = (ToolStripDropDown)(e.Control as DataGridFilterControl).GetType().BaseType.GetField("filterPopup", System.Reflection.BindingFlags.Instance | 
        System.Reflection.BindingFlags.NonPublic).GetValue(e.Control as FilterControlBase); 
    toolstrip.Closed += Toolstrip_Closed; 
} 
 
private void Toolstrip_Closed(object sender, ToolStripDropDownClosedEventArgs e) 
{ 
    // Do your customizations here 
} 


Please let us know if you require any other assistance from us.  

Regards, 
Mohanram A. 


Marked as answer

JE Jeremy July 19, 2021 12:36 PM UTC

Mohanram,


Thanks for the quick reply. The snippet does indeed give me what I was after.


Thanks again.


Jeremy



MA Mohanram Anbukkarasu Syncfusion Team July 20, 2021 04:59 AM UTC

Hi Jeremy, 

Thanks for the update.  

We are glad to know that the provided solution worked at your end. Please let us know if you require any other assistance from us. We are happy to help you. 

Regards, 
Mohanram A. 


Loader.
Up arrow icon