Framework:Javascript Data GridAngular Data GridReact Data GridVue Data Grid

Vue Data Grid: 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.

Mini Filter

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:

<ag-grid-vue
    :columnDefs="columnDefs"
    /* other grid options ... */>
</ag-grid-vue>

this.columnDefs = [
    {
        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 because filterParams.applyMiniFilterWhileTyping = true.

Custom Searches

Sometimes it is necessary to provide custom handling for Mini Filter searches, for example to substitute accented characters.

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:

<ag-grid-vue
    :columnDefs="columnDefs"
    /* other grid options ... */>
</ag-grid-vue>

this.columnDefs = [
    {
        field: 'athlete',
        filter: 'agSetColumnFilter',
        filterParams: {
            textFormatter: value => {
                return value
                    .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'.

Enabling Case-Sensitive Searches

By default the Mini Filter is case-insensitive. Practically this means that searching for bl would match Filter List values of Black, blue and BLONDE.

Case-sensitive searches can be enabled by using the caseSensitive filter parameter:

<ag-grid-vue
    :columnDefs="columnDefs"
    /* other grid options ... */>
</ag-grid-vue>

this.columnDefs = [
    {
        field: 'colour',
        filter: 'agSetColumnFilter',
        filterParams: {
            caseSensitive: true
        }
    }
];

The caseSensitive option also affects the values presented in the Filter List and API behaviours.

See Example: Filter List Case-Sensitivity for a demonstration of the change in behaviour.

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:

<ag-grid-vue
    :columnDefs="columnDefs"
    /* other grid options ... */>
</ag-grid-vue>

this.columnDefs = [
    {
        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: Excel Mode.