ComponentOne ASP.NET MVC Controls
FlexSheetFilter Class
File
wijmo.grid.sheet.js
Module
wijmo.grid.sheet
Base Class
FlexGridFilter

Implements an Excel-style filter for FlexSheet controls.

To enable filtering on a FlexSheet control, create an instance of the FlexSheetFilter and pass the grid as a parameter to the constructor.

Constructor

Properties

Methods

Events

Constructor

constructor

constructor(grid: FlexGrid, options?: any): FlexGridFilter

Initializes a new instance of the FlexGridFilter class.

Parameters
Optional

Initialization options for the FlexGridFilter.

Inherited From
FlexGridFilter
Returns
FlexGridFilter

Properties

activeEditor

Gets the active ColumnFilterEditor.

This property allows you to customize the filter editor when handling the filterChanging event. It returns null when no filters are being edited.

Inherited From
FlexGridFilter
Type
ColumnFilterEditor

defaultFilterType

Gets or sets the default filter type to use.

This value can be overridden in filters for specific columns. For example, the code below creates a filter that filters by conditions on all columns except the "ByValue" column:

var f = new wijmo.grid.filter.FlexGridFilter(flex);
f.defaultFilterType = wijmo.grid.filter.FilterType.Condition;
var col = flex.columns.getColumn('ByValue'),
    cf = f.getColumnFilter(col);
cf.filterType = wijmo.grid.filter.FilterType.Value;

The default value for this property is FilterType.Both.

Inherited From
FlexGridFilter
Type
FilterType

exclusiveValueSearch

Gets or sets a value that determines whether the filter should include only values selected by the filterText property.

This property is set to true by default, which matches Excel's behavior.

Set it to false to disable this behavior, so searching only affects which items are displayed on the list and not which items are included in the filter.

Inherited From
FlexGridFilter
Type
boolean

filterColumns

Gets or sets an array containing the names or bindings of the columns that have filters.

Setting this property to null or to an empty array adds filters to all columns.

Inherited From
FlexGridFilter
Type
string[]

filterDefinition

Gets or sets the current filter definition as a JSON string.

Type
string

grid

Gets a reference to the FlexGrid that owns this filter.

Inherited From
FlexGridFilter
Type
FlexGrid

showFilterIcons

Gets or sets a value indicating whether the FlexGridFilter adds filter editing buttons to the grid's column headers.

If you set this property to false, then you are responsible for providing a way for users to edit, clear, and apply the filters.

The default value for this property is true.

Inherited From
FlexGridFilter
Type
boolean

showSortButtons

Gets or sets a value indicating whether the filter editor should include sort buttons.

By default, the editor shows sort buttons like Excel does. But since users can sort columns by clicking their headers, sort buttons in the filter editor may not be desirable in some circumstances.

The default value for this property is true.

Inherited From
FlexGridFilter
Type
boolean

Methods

apply

apply(): void

Applies the current column filters to the sheet.

Returns
void

clear

clear(): void

Clears all column filters.

Inherited From
FlexGridFilter
Returns
void

closeEditor

closeEditor(): void

Closes the filter editor.

Returns
void

editColumnFilter

editColumnFilter(col: any, ht?: HitTestInfo): void

Shows the filter editor for the given grid column.

Parameters
Optional

A HitTestInfo object containing the range of the cell that triggered the filter display.

Returns
void

getColumnFilter

getColumnFilter(col: any, create?: boolean): FlexSheetColumnFilter

Gets the filter for the given column.

Parameters
Optional

Whether to create the filter if it does not exist.

Returns
FlexSheetColumnFilter

onFilterApplied

onFilterApplied(e?: EventArgs): void

Raises the filterApplied event.

Parameters
Inherited From
FlexGridFilter
Returns
void

onFilterChanged

onFilterChanged(e: CellRangeEventArgs): void

Raises the filterChanged event.

Parameters
Inherited From
FlexGridFilter
Returns
void

onFilterChanging

onFilterChanging(e: CellRangeEventArgs): boolean

Raises the filterChanging event.

Parameters
Inherited From
FlexGridFilter
Returns
boolean

Events

filterApplied

Occurs after the filter is applied.

Inherited From
FlexGridFilter
Arguments
EventArgs

filterChanged

Occurs after a column filter has been edited by the user.

Use the event parameters to determine the column that owns the filter and whether changes were applied or canceled.

Inherited From
FlexGridFilter
Arguments
CellRangeEventArgs

filterChanging

Occurs when a column filter is about to be edited by the user.

Use this event to customize the column filter if you want to override the default settings for the filter.

For example, the code below sets the operator used by the filter conditions to 'contains' if they are null:

filter.filterChanging.addHandler(function (s, e) {
  var cf = filter.getColumnFilter(e.col);
  if (!cf.valueFilter.isActive && cf.conditionFilter.condition1.operator == null) {
    cf.filterType = wijmo.grid.filter.FilterType.Condition;
    cf.conditionFilter.condition1.operator = wijmo.grid.filter.Operator.CT;
  }
});
Inherited From
FlexGridFilter
Arguments
CellRangeEventArgs