Creating Filterable Row Styles

How to leverage Named Queries to create full-row Conditional Styles, and provide custom Dashboard Buttons and Menu Items to easily filter them using the Grid Filter

5 min readFebruary 24, 2026

Feedback

Our User's Question

We were recently contacted by an AdapTable user with an interesting request.

She asked how she could achieve the following 2-step process in AG Grid:

  • enable run-time users to create full-row styles (using a custom Rule)

  • help these users easily to filter the Grid using the created styles

Our Solution and Demo

Use Named Queries to Filter by Styles (v21)

In response, we provide a demo illustrating how this is possible using these AdapTable functions:

Important

Our demo uses only existing AdapTable functionality, UI components and API methods

Use Named Queries to Filter by Styles
Fork
  • The Grid contains 3 full row Conditional Styles
  • Clicking a Dashboard button (or selecting a custom Column or Context Menu Item) will filter the Grid by that Style

Named Queries

The key is to leverage Named Queries, a powerful, and often under-used, AdapTable feature.

As the name imples, Named Queries are simply named AdapTableQL Boolean Expressions.

Note

By giving the Query a Name, it can easily be shared and re-used in multiple modules (see below)

In our example we create 3 Named Queries, each of which groups a set of Frameworks.

Hint

The Named Queries Expressions use the AdapTableQL IN Expression Function

Three Named Queries: 'Frequently Used', 'Occasional Usage' and 'Rarely Used'
Three Named Queries: 'Frequently Used', 'Occasional Usage' and 'Rarely Used'

We then re-use each Named Query in a number of ways.

Conditional Styles

We configure a separate full-row Conditional Style for each Named Query.

Each Conditional Style Rule wraps a different Named Query and provides a distinct style.

Hint

  • The Conditional Style expressions themselves are very straightforward
  • They simply leverage the AdaptableQL QUERY expression function which wraps a Named Query
Rule: {
    BooleanExpression: 'QUERY("Frequently Used")',
},
We create 3 Conditional Styles, one for each Named Query
We create 3 Conditional Styles, one for each Named Query

UI Components

Next we leverage 3 of the UI components provided by AdapTable.

Column Menu

We provide a Custom Column Menu Item in each Column Menu.

The Menu Item lists all the Named Queries, as sub menu items, and then filters the Grid using the value selected.

The 'Filter By' Custom Column Menu Item filters the Grid by Named Query
The 'Filter By' Custom Column Menu Item filters the Grid by Named Query

Context Menu

We also provide a Custom Context Menu Item in each Grid Cell.

The Context Menu Item works out which Named Query is associated with that Grid Cell's row.

When the menu item is selected, it filters the Grid by that Named Query.

The 'Filter By xxx' Custom Context Menu Item filters the Grid by Named Query for that row
The 'Filter By xxx' Custom Context Menu Item filters the Grid by Named Query for that row

Dashhboard Toolbars and Buttons

Finally, we create a Custom Toolbar to display in the Dashboard.

We dynamically render an Adaptable Button for each Named Query.

When the Button is clicked, we filter the Grid by that Named Query.

We also provide a Clear Filter Button to remove any filtering.

Important

  • Because we want to create the Buttons dynamically we don't configure them in Dashboard Options
  • Instead we create them on the fly by subscribing to 2 of the most frequently used Adaptable Events:
We dynamically create a Button for each Conditional Style that wraps a Named Query
We dynamically create a Button for each Conditional Style that wraps a Named Query

Grid Filter

The last element in our demo is the Grid Filter - a powerful, cross-column filtering module.

Note

The Grid Filter runs in parallel with Column Filters, enabling the richest DataGrid functionality available

At its heart, the Grid Filter is an intuitive wrapper around an AdapTableQL Boolean Expression.

This makes it trivial to filter the Grid using our Named Queries.

Each time the user selects a custom Menu Option, or clicks a Dashboard Button, the onClick functions simply create, and set, a new Grid Filter Expression dynamically.

Hint

We leverage the useful setGridFilterExpressionUsingNamedQuery function in Grid Filter Api:

gridFilterApi.setGridFilterExpressionUsingNamedQuery(query);
We add Grid Filter Toolbar to Dashboard to show the Grid Filter Expression dynamically created
We add Grid Filter Toolbar to Dashboard to show the Grid Filter Expression dynamically created

Extensibility

As noted above, we create, and display the Dashboard Buttons dynamically.

This provides our demo with one big advantage: each time we create a new Format Column which wraps a Named Query, a new Dashboard button will automatically appear.

Note

  • In our demo we deliberately leave 3 Frameworks without a Name: backbone, gatsby & knockout
  • Below we create a new Named Query, and associated Style, and a new Button dynamically appears