ColumnFilterPanel
Namespace: Wisej.Web.Ext.ColumnFilter
Assembly: Wisej.Web.Ext.ColumnFilter (4.1.0.0)
Base class for the filter panels to use in conjunction with the ColumnFilter extender.
- C#
- VB.NET
public class ColumnFilterPanel : UserPopup
Public Class ColumnFilterPanel
Inherits UserPopup
The panel is a UserPopup that the ColumnFilter creates for each column the first time the user clicks the column's filter button. Pressing Enter applies the filters of all the columns, pressing Escape closes the panel. Derived classes implement OnApplyFilter to hide the rows that don't match the criteria selected by the user. Note that the base class doesn't make the rows visible again before applying the filters and doesn't close the panel: the built-in panels do it in their override of ApplyFilters.
Example:
A custom filter panel that shows only the rows with a non-empty value:
public class NotEmptyFilterPanel : ColumnFilterPanel
{
protected override bool OnApplyFilter()
{
var column = this.DataGridViewColumn;
var dataGrid = column.DataGridView;
foreach (var row in dataGrid.Rows)
{
if (!row.IsNewRow && string.IsNullOrEmpty(Convert.ToString(row[column.Index].Value)))
row.Visible = false;
}
return true;
}
}
Constructors
ColumnFilterPanel()
Initializes a new instance of the ColumnFilterPanel class.
Properties
ColumnFilter
ColumnFilter: Returns the instance of the ColumnFilter that is managing this ColumnFilterPanel.
DataGridViewColumn
DataGridViewColumn: Returns the DataGridViewColumn bound to this ColumnFilterPanel.
Set by the ColumnFilter when it creates the panel; it's null after the panel is disposed.
FilterButton
PictureBox: Returns the control used as the filter button.
Returns the control in the header cell of DataGridViewColumn, or null if it's not a PictureBox (i.e. when CreateFilterButton has been overridden to return a different control).
Methods
ApplyFilters()
Applies the filters registered with each column in the order of creation in the Columns collection.
Clear(applyFilters)
Clears the filter criteria of this panel.
| Parameter | Type | Description |
|---|---|---|
| applyFilters | Boolean | True (default) to re-apply the filters of all the columns after clearing the criteria. |
The base implementation doesn't do anything; derived panels override it to reset their controls.
Example:
Clearing the filters of all the columns of a DataGridView:
foreach (DataGridViewColumn column in this.dataGridView1.Columns)
{
var panel = column.UserData.FilterPanel as ColumnFilterPanel;
panel?.Clear(false);
}
this.columnFilter1.ApplyFilters(this.dataGridView1);
Dispose(disposing)
Clean up any resources being used.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | true if managed resources should be disposed; otherwise, false. |
GetFilterPanels()
Returns all the ColumnFilterPanel panels associated to the columns of the DataGridView that owns the DataGridViewColumn linked to the calling panel.
Returns: ColumnFilterPanel[].
OnAfterShow()
Invoked when the ColumnFilterPanel after is visible on the client.
OnApplyFilter()
Invoked when the ColumnFilterPanel should apply the filter criteria selected by the user.
Returns: Boolean. True to indicate that the filter has been applied. False if the filter has been cleared.
OnBeforeShow()
Invoked when the ColumnFilterPanel is shown but before it is visible on the client.
OnLoad(e)
Performs initialization tasks when the panel is created.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | Event arguments |
OnWebEvent(e)
Processes the event from the client.
| Parameter | Type | Description |
|---|---|---|
| e | WisejEventArgs | Event arguments. |
OnWebRender(config)
Renders the client component.
| Parameter | Type | Description |
|---|---|---|
| config | Object | Dynamic configuration object |
Inherited By
| Name | Description |
|---|---|
| SimpleColumnFilterPanel | Simple column filter panel showing the unique values found in the bound column in a checked list box. The user can select multiple values, clear the selection or select all. |
| WhereColumnFilterPanel | Column filter panel that lets the user build up to five conditions, each made of an operator and a value, combined with AND/OR. The available operators depend on the ValueType of the column. |