Skip to main content

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.

public class ColumnFilterPanel : 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​

Instance member ColumnFilterPanel()​

Initializes a new instance of the ColumnFilterPanel class.

Properties​

Instance member ColumnFilter​

ColumnFilter: Returns the instance of the ColumnFilter that is managing this ColumnFilterPanel.

Instance member 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.

Instance member 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​

Protected member ApplyFilters()​

Applies the filters registered with each column in the order of creation in the Columns collection.

Instance member Clear(applyFilters)​

Clears the filter criteria of this panel.

ParameterTypeDescription
applyFilters optionalBooleanTrue (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);

Protected member Dispose(disposing)​

Clean up any resources being used.

ParameterTypeDescription
disposingBooleantrue if managed resources should be disposed; otherwise, false.

Protected member GetFilterPanels()​

Returns all the ColumnFilterPanel panels associated to the columns of the DataGridView that owns the DataGridViewColumn linked to the calling panel.

Returns: ColumnFilterPanel[].

Protected member OnAfterShow()​

Invoked when the ColumnFilterPanel after is visible on the client.

Protected member 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.

Protected member OnBeforeShow()​

Invoked when the ColumnFilterPanel is shown but before it is visible on the client.

Protected member OnLoad(e)​

Performs initialization tasks when the panel is created.

ParameterTypeDescription
eEventArgsEvent arguments

Protected member OnWebEvent(e)​

Processes the event from the client.

ParameterTypeDescription
eWisejEventArgsEvent arguments.

Protected member OnWebRender(config)​

Renders the client component.

ParameterTypeDescription
configObjectDynamic configuration object

Inherited By​

NameDescription
SimpleColumnFilterPanelSimple 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.
WhereColumnFilterPanelColumn 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.

Implements​