The Advanced Filter allows for complex filter conditions to be entered across columns in a single type-ahead input, as well as within a hierarchical visual builder.
Enabling Advanced Filter Copy LinkThe Advanced Filter is enabled by setting the property enableAdvancedFilter = true
. By default, the Advanced Filter is displayed between the column headers and the grid rows, where the Floating Filters would be displayed if they were enabled.
const gridOptions = {
enableAdvancedFilter: true,
}
The following example demonstrates the Advanced Filter:
athlete
into the Advanced Filter input. As you type, the list of suggested column names will be filtered down.Athlete
entry by pressing ⵠEnter or ⥠Tab, or using the mouse to click on the entry.contains
entry in a similar way.michael
followed by an end quote ("
).Apply
button to execute the filter.michael
.AND
and OR
along with brackets - (
and )
.Advanced Filter and Column Filters cannot be active at the same time. Enabling Advanced Filter will disable Column Filters.
Advanced Filter Builder Copy LinkAs well as typing into the Advanced Filter input, Advanced Filters can also be set by using the Advanced Filter Builder. This displays a hierarchical view of the filter, and allows the different filter parts to be set using dropdowns and inputs. It also allows for filter conditions to be added, deleted and reordered.
The Advanced Filter Builder can be launched by clicking the Builder
button next to the Advanced Filter input.
The following example demonstrates the Advanced Filter Builder:
Apply
button to apply the filter.For a column to appear in the Advanced Filter, it needs to have filter: true
(or set to a non-null and non-false value).
The type of the filter options displayed is based on the Cell Data Type of the column.
The different properties that can be set for each column are explained in the sections below, and demonstrated in the following example:
filter = false
.contains
option and is case sensitive.headerValueGetter
defined and use the location
property to have a different name in the filter (with a (-)
suffix).By default, hidden columns do not appear in the Advanced Filter. To make hidden columns appear, set includeHiddenColumnsInAdvancedFilter = true
.
boolean
default: false
Hidden columns are excluded from the Advanced Filter by default. To include hidden columns, set to true
.
When Row Grouping, group columns will not appear in the Advanced Filter. The underlying columns will always appear, even if hidden.
Column Names Copy LinkThe name by which columns appear in the Advanced Filter can be configured by using a Header Value Getter and checking for location = 'advancedFilter'
.
Certain properties can be set by using colDef.filterParams
.
const gridOptions = {
columnDefs: [
{
field: 'athlete',
filterParams: {
caseSensitive: true,
filterOptions: ['contains'],
}
}
],
}
For all Cell Data Types, the available filter options can be set via filterOptions
.
The available options are as follows:
Option Name Option Key Cell Data Type containscontains
text
, object
does not contain notContains
text
, object
equals equals
text
, object
= equals
number
, date
, dateString
, dateTime
, dateTimeString
not equal notEqual
text
, object
!= notEqual
number
, date
, dateString
, dateTime
, dateTimeString
begins with startsWith
text
, object
ends with endsWith
text
, object
is blank blank
text
, number
, boolean
, date
, dateString
, dateTime
, dateTimeString
, object
is not blank notBlank
text
, number
, boolean
, date
, dateString
, dateTime
, dateTimeString
, object
> greaterThan
number
, date
, dateString
, dateTime
, dateTimeString
>= greaterThanOrEqual
number
, date
, dateString
, dateTime
, dateTimeString
< lessThan
number
, date
, dateString
, dateTime
, dateTimeString
<= lessThanOrEqual
number
, date
, dateString
, dateTime
, dateTimeString
is true true
boolean
is false false
boolean
For text
and object
Cell Data Types, caseSensitive = true
can be set to enable case sensitivity.
For number
, date
, dateString
, dateTime
and dateTimeString
Cell Data Types, the following properties can be set to include blank values for the relevant options:
includeBlanksInEquals = true
includeBlanksInLessThan = true
includeBlanksInGreaterThan = true
These settings only apply when using the Client-Side Row Model. You need to implement support for these in your server-side filtering logic when using the Server-Side Row Model.
Filter Model / API Copy LinkThe Advanced Filter model describes the current state of the Advanced Filter. This is represented by an AdvancedFilterModel
, which is either a ColumnAdvancedFilterModel
for a single condition, or a JoinAdvancedFilterModel
for multiple conditions:
'join'
'join'
'AND' | 'OR'
How the conditions are joined together
AdvancedFilterModel[]
The filter conditions that are joined by the type
For example, the Advanced Filter ([Age] > 23 OR [Sport] ends with "ing") AND [Country] contains "united"
would be represented by the following model:
const advancedFilterModel = {
filterType: 'join',
type: 'AND',
conditions: [
{
filterType: 'join',
type: 'OR',
conditions: [
{
filterType: 'number',
colId: 'age',
type: 'greaterThan',
filter: 23,
},
{
filterType: 'text',
colId: 'sport',
type: 'endsWith',
filter: 'ing',
}
]
},
{
filterType: 'text',
colId: 'country',
type: 'contains',
filter: 'united',
}
]
};
The Advanced Filter Model can be retrieved via the API method getAdvancedFilterModel
, and set via the API method setAdvancedFilterModel
.
Function
Get the state of the Advanced Filter. Used for saving Advanced Filter state
AdvancedFilterModuleFunction
Set the state of the Advanced Filter. Used for restoring Advanced Filter state
AdvancedFilterModuleThe Advanced Filter Model can be saved and restored as part of Grid State.
The Advanced Filter Model and API methods are demonstrated in the following example:
Save Advanced Filter Model
will save the current Advanced Filter.Restore Advanced Filter Model
will restore the previously saved Advanced Filter.Set Custom Advanced Filter Model
will set [Gold] >= 1
.Clear Advanced Filter
will clear the current Advanced Filter.It is possible to customise the buttons displayed in the Advanced Filter, allowing for the use of other Filter Buttons such as Reset, Cancel and Clear.
The Advanced Filter can be configured using the IAdvancedFilterParams
interface:
FilterAction[]
default: ['apply']
Specifies the buttons to be shown in the Advanced Filter, in the order they should be displayed in. The options are:
'apply'
: The Apply button will apply the filter.'clear'
: The Clear button will clear the filter input without removing the current active filter.'reset'
: The Reset button will clear the filter and apply an empty filter.'cancel'
: The Cancel button will discard any changes that have been made to the filter in the UI, restoring the applied model.boolean
default: false
Whether to hide the Builder button to open the Advanced Filter Builder
The params can be set via the grid option advancedFilterParams
:
The following example demonstrates configuring the Advanced Filter:
Builder
button has been removed, and the Advanced Filter Builder must now be opened via the API.buttons
have been configured to add the Clear and Reset buttons.By default the Advanced Filter is displayed underneath the Column Headers, where the Floating Filters would normally appear.
It is possible to instead display the Advanced Filter outside of the grid (such as above it). This can be done by setting the grid option advancedFilterParent
and providing it with a DOM element to contain the filter.
DOM element to use as the parent for the Advanced Filter to allow it to appear outside of the grid. Set to null
or undefined
to appear inside the grid.
The Popup Parent must also be set to an element that contains both the Advanced Filter parent and the grid.
The following example demonstrates displaying the Advanced Filter outside of the grid:
The Advanced Filter Builder can be configured using the IAdvancedFilterBuilderParams
interface:
number
default: 120
Width in pixels of the Advanced Filter Builder add button select popup.
FilterAction[]
default: ['apply', 'cancel']
Specifies the buttons to be shown in the Advanced Filter Builder, in the order they should be displayed in. The options are:
'apply'
: The Apply button will apply the filter and close the builder.'clear'
: The Clear button will clear the filter in the builder without removing the current active filter.'reset'
: The Reset button will clear the filter and apply an empty filter.'cancel'
: The Cancel button will discard any changes that have been made to the filter in the UI, and close the Builder without applying any changes.number
default: 500
Minimum width in pixels of the Advanced Filter Builder popup.
number
default: 200
Max width in pixels of the Advanced Filter Builder pill select popup.
number
default: 140
Min width in pixels of the Advanced Filter Builder pill select popup.
boolean
default: false
Whether to show the move up and move down buttons in the Advanced Filter Builder.
boolean
default: false
Whether to hide the Full Screen button in the Advanced Filter Builder.
The params can be set via the grid option advancedFilterBuilderParams
:
IAdvancedFilterBuilderParams
Customise the parameters passed to the Advanced Filter Builder.
AdvancedFilterModuleAs well as using the button in the Advanced Filter, it's possible to launch the Advanced Filter Builder via the showAdvancedFilterBuilder
grid API method, and hide it via hideAdvancedFilterBuilder
:
Function
Open the Advanced Filter Builder dialog (if enabled).
AdvancedFilterModuleFunction
Closes the Advanced Filter Builder dialog (if enabled). Un-applied changes are discarded.
AdvancedFilterModuleWhen the Advanced Filter Builder is shown or hidden, the advancedFilterBuilderVisibleChanged
event is fired:
AdvancedFilterBuilderVisibleChangedEvent
Advanced Filter Builder visibility has changed (opened or closed).
The following example demonstrates configuring the Advanced Filter Builder:
Advanced Filter Builder
button displays the Advanced Filter Builder via the API method showAdvancedFilterBuilder
.advancedFilterBuilderVisibleChanged
event is used to toggle the disabled status of the Advanced Filter Builder
button.showMoveButtons
param is set in the advancedFilterBuilderParams
, which displays buttons allowing the filter rows to be moved up and down (including via keyboard navigation).All of the Cell Data Types are supported in the Advanced Filter. The behaviour of each is described below.
Date
via the Value Parser.Date
using the Value Parser and the Date Parser. This is compared against the cell values, which are also converted using the Date Parser.The Advanced Filter will only work on leaf-level rows when using Aggregation. The groupAggFiltering
property will be ignored.
When Pivoting, Pivot Result Columns will not appear in the Advanced Filter. However, primary columns (including underlying group and pivot columns) will be shown in the Advanced Filter.
Server-Side Row Model Copy LinkIn addition to the Client-Side Row Model, the Advanced Filter can be used with the Server-Side Row Model. See the SSRM Advanced Filter Example for more information.
Localisation Copy LinkIf providing custom Localisation values for the Advanced Filter, note that if the filter option values contain spaces, one option value cannot start with another option value.
Next Up Copy LinkContinue to the next section to learn about External Filters.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4