GridX Filtering System
Three-tier filtering — BeepQuickFilterBar, BeepAdvancedFilterDialog (AND/OR logic, save/load configs), per-column filter popups, Excel-style filter helpers
Table of Contents
Overview
GridX provides a three-tier filtering architecture that scales from simple real-time text filtering up to complex multi-condition logic:
| Tier | Component | Complexity | Use Case |
|---|---|---|---|
| 1. Quick Filter | BeepQuickFilterBar | Low | Real-time text filtering, one input per visible column |
| 2. Per-Column | BeepGridFilterPopup / FilterFlyout | Medium | Checkbox list of distinct values, Search/Select All/Clear All |
| 3. Advanced | BeepAdvancedFilterDialog | High | AND/OR logic, multi-column conditions, save/load filter configs |
Filtering is integrated with GridSortFilterHelper and supports operators: Contains, Equals, NotEquals, StartsWith, EndsWith, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, IsNull, IsNotNull, Between.
BeepAdvancedFilterDialog
BeepAdvancedFilterDialog inherits from BeepiFormPro and presents a 900x500 resizable dialog for building complex filter conditions. It uses an embedded BeepGridPro where each row defines one filter condition (Column, Operator, Value, optional Value2 for Between).
| Member | Type | Description |
|---|---|---|
Result | DialogResult | Returns OK if user clicked Apply/OK, Cancel otherwise |
LogicOperator | LogicOperator | AND or OR — determines how multiple conditions are combined |
FilterRows | BindingList<FilterRowData> | Data-bound list of filter conditions |
The dialog layout:
- Logic combo: Dropdown at the top selecting AND (all conditions must match) or OR (any condition matches)
- Filter grid: BeepGridPro with columns: Column (ComboBox of grid columns), Operator (ComboBox of operators), Value (TextBox), Value2 (TextBox, visible only for Between operator)
- Action buttons: Add Condition, Remove Condition, Clear All, Save Config, Load Config, OK, Cancel
Constructor signature: BeepAdvancedFilterDialog(BeepGridPro parentGrid, List<FilterRowData> existingRows = null, LogicOperator existingLogic = LogicOperator.AND)
FilterRowData Model
FilterRowData implements INotifyPropertyChanged and represents a single filter condition.
| Property | Type | Default | Description |
|---|---|---|---|
ColumnName | string | "" | Target column for this filter condition |
Operator | FilterOperator | Contains | Comparison operator |
Value | string | "" | Primary filter value |
Value2 | string | "" | Secondary value for Between operator (range end) |
The FilterOperator enum includes: Contains, Equals, NotEquals, StartsWith, EndsWith, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, IsNull, IsNotNull, Between.
BeepQuickFilterBar
BeepQuickFilterBar renders a toolbar row above the grid column headers with one text input per visible column. Typing in any input instantly filters the grid's data source.
| Property | Type | Default | Description |
|---|---|---|---|
ShowTopFilterPanel | bool | false | Enables the quick filter bar |
TopFilterPanelHeight | int | 28 | Pixel height of the filter bar row |
Filtering uses Contains operator (case-insensitive) by default. The filter is applied in real time as the user types — no Enter key or button press needed. The filter bar respects column visibility: only visible columns get filter inputs.
Per-Column Popups
BeepGridFilterPopup (also referred to as FilterFlyout) provides an Excel-style dropdown of distinct values for a single column. It appears when the user clicks a filter icon in the column header.
Key UI elements:
- Search box — filters the distinct value list itself
- Checkbox list — each distinct value with a checkbox; checked = included in results
- Select All / Clear All — bulk toggle buttons
- OK / Cancel — apply or discard filter
The popup is populated by calling GetDistinctValues(columnName) on the data source. For large datasets, a configurable limit (default 1000) prevents excessive popup rendering. The popup auto-sizes based on content and positions relative to the column header.
Filter Dialogs & Helpers
| Class | Description |
|---|---|
GridDialogHelper.FilteringDialogs | Static helper that launches filtering-related dialogs from toolbar/menu actions |
BeepInlineCriterionMenu | Inline filter row rendered inside the grid between header and data rows; adds a filter criterion row with dropdowns |
ExcelFilterHelper | Provides Excel-style distinct-value filtering: GetDistinctValues(), HasActiveFilter(), ClearFilter(), ApplyChecklistFilter() |
ExcelFilterHelper works directly with the grid's DataView or IBindingListView to apply row filters. It translates checkbox selections into a DataView.RowFilter string expression.
Examples
Enable Quick Filter Bar
grid.ShowTopFilterPanel = true;
grid.TopFilterPanelHeight = 32;Open Advanced Filter Dialog
var dialog = new BeepAdvancedFilterDialog(grid)
{
PreferredContentWidth = 900,
PreferredContentHeight = 500
};
if (dialog.ShowDialog() == DialogResult.OK)
{
GridDialogHelper.FilteringDialogs.ApplyAdvancedFilter(
grid,
dialog.FilterRows.ToList(),
dialog.LogicOperator);
}Save & Load Filter Configs
var filterRows = new List<FilterRowData>
{
new FilterRowData { ColumnName = "Status", Operator = FilterOperator.Equals, Value = "Active" },
new FilterRowData { ColumnName = "Amount", Operator = FilterOperator.GreaterThan, Value = "1000" }
};
string json = JsonConvert.SerializeObject(filterRows);
File.WriteAllText(@"C:\configs\myfilter.json", json);
var loaded = JsonConvert.DeserializeObject<List<FilterRowData>>(
File.ReadAllText(@"C:\configs\myfilter.json"));
GridDialogHelper.FilteringDialogs.ApplyAdvancedFilter(
grid, loaded, LogicOperator.AND);Programmatic Distinct-Value Filter
var helper = new ExcelFilterHelper(grid);
var distinctValues = helper.GetDistinctValues("Country");
var selectedValues = new List<string> { "USA", "Canada", "UK" };
helper.ApplyChecklistFilter("Country", selectedValues);
bool hasFilter = helper.HasActiveFilter("Country");
helper.ClearFilter("Country");