Set Filter - Mini Filter

This section describes the behaviour of the Mini Filter and shows how it can be configured.

The Mini Filter allows the user to search for particular values in the Filter List. Entering text into the Mini Filter will narrow down the presented list of values shown inside the Set Filter, but by default will not filter the data inside the grid.

Keyboard Shortcuts

When the Enter key is pressed while on the Mini Filter, the Set Filter will exclusively select all values in the Filter List that pass the Mini Filter and apply the filter immediately (note that even if an Apply Button is used, hitting Enter applies the filter).

Alternatively, you can choose to have the Mini Filter applied as the user is typing, i.e. as the Filter List is filtered, the Set Filter will be applied as described above so that the results in the grid will also be filtered at the same time. To enable this behaviour, use the following:

// ColDef { field: 'country', filter: 'agSetColumnFilter', filterParams: { applyMiniFilterWhileTyping: true, }, }

The following example demonstrates this behaviour. Note the following:

  • The Athlete column's Set Filter shows the Mini Filter with default behaviour. Try typing in the Mini Filter to search the Filter List, and then hit the Enter key and notice how the grid is filtered using the displayed values.
  • The Country column's Set Filter applies the Mini Filter as you type as filterParams.applyMiniFilterWhileTyping = true.

Custom Searches

Sometimes it is necessary to provide custom handling for Mini Filter searches, for example to substitute accented characters or to perform case-sensitive searches.

As with the Text Filter it is possible to supply a Text Formatter to the Set Filter which formats the text before applying the Mini Filter compare logic. The snippet below shows how this can be configured:

// ColDef { field: 'athlete', filter: 'agSetColumnFilter', filterParams: { textFormatter: function(value) { return value .toLowerCase() .replace(/\s/g, '') .replace(/[àáâãäå]/g, 'a') .replace(/æ/g, 'ae') .replace(/ç/g, 'c') .replace(/[èéêë]/g, 'e') .replace(/[ìíîï]/g, 'i') .replace(/ñ/g, 'n') .replace(/[òóôõö]/g, 'o') .replace(/œ/g, 'oe') .replace(/[ùúûü]/g, 'u') .replace(/[ýÿ]/g, 'y') .replace(/\W/g, ''); } } }

The following example demonstrates searching when there are accented characters. Note the following:

  • The Athlete column's Set filter is supplied a text formatter via filterParams.textFormatter to ignore accents.
  • Searching using 'bjorn' will return all values containing 'björn'.

Text Customisation

Text used in the Mini Filter can be customised using Localisation.

The text shown as a placeholder in the Mini Filter textbox can be customised by setting 'searchOoo'.

When no matching values are found when typing in the Mini Filter, a message is displayed. This can be customised by setting 'noMatches'.

The example below shows this text being customised.

Hiding the Mini Filter

By default, the Mini Filter is shown whenever the Set Filter is used. If you would like to hide it, you can use the following:

// ColDef { field: 'country', filter: 'agSetColumnFilter', filterParams: { suppressMiniFilter: true, }, }

The following example demonstrates hiding the mini filter. Note the following:

  • The Athlete column's Set Filter shows the Mini Filter by default.
  • The Country column's Set Filter does not have a Mini Filter as filterParams.suppressMiniFilter = true.

Next Up

Continue to the next section: Set Filter API.