Server-Side Row Model - Filtering

Summary

  • Both Column Filters and the Grid Filter need to be evaluated remotely when using Server-Side Row Model
  • AdapTable provides functions that helps developers retrieve latest Filter state (to pass in to server)
  • It also provides functions which can manage the complexity of both Predicates and Expressions

When using the Server-Side Row Model, AG Grid will not perform any filtering.

Note

  • Quick Search works fully in Server-Side Row Model, both for data already in the Grid and new data as it is fetched
  • However Quick Search as Filter will not work (unless you implement it yourself)

Instead AG Grid hands off those tasks to developer to perform on the server.

Caution

When using the Server-Side Row Model, it is the developer's responsibility to perform the actual filtering on the server

In practice this requires developers to provide server equivalents of 2 AdapTable filtering mechanisms:

Find Out More

AdaptableQL Server Evaluation provides instructions for managing complexity and scope of Predicates & Expressions

Getting Filter State

When using the Server-Side Row Model, you need to fetch the current filter (and sort) state from AdapTable inside the getRows function.

Note

The Grid Filter Applied and Column Filter Applied Events still fire, but are rarely subscribed to when using the SSRM

This is most easily done through the getAdaptableFilterState function in the State API section of Adaptable API.

It returns an AdaptableFilterState object defined as follows:

PropertyDescription
columnFilterDefsColumn Filter definitions for currently applied Column Filters
columnFiltersCurrently applied Column Filters
gridFilterCurrent Grid Filter
gridFilterASTAST for Current Grid Filter

Columns Filters

Column Filters can still be applied when using the Server-Side Row Model, but instead of the Predicates being automatically evaluated by AdapTable, they are evaluated by developers on the server.

Hint

This can also include Custom Filters, which will also be evaluated remotely in a bespoke implementation

In Filter Values

AdapTable provides an In Filter, which allows users to select from a list of values for the Column.

By default, AdapTable simply lists all distinct values currently visible in the Grid's data source for the Column.

This is fine when using the Client-Side Row Model - as all data has been loaded - but can be unsatisfactory for the Server-Side Row Model, since it can result in a unnecessarily reduced list of values.

For this reason it is common when using the SSRM to implement the customInFilterValues property in Filter Options in order to provide a fuller list of values.

Hint

Find Out More

See Guide to Using the In Filter for full details (and multiple demos)

Limiting Predicates

By default AdapTable will provide every relevant System Predicate in each column.

This means a bespoke server implementation will need to translate every predicate into something meaningful.

Accordingly, AdapTable allows developer to limit which System Predicates are available in order to make the server implementation more manageable.

SSRM - Column Filtering
Fork
  • The example shows how AdapTable Column Filters can still be used while using Server-Side Row Model:
  • We get the current AdapTable Filter State and pass that to our mock server to evaluate
  • We add a Custom Filter Predicate called Superstar with Scope of Athlete column - and which also gets evaluated on the mock server (using rule: gold > 2 OR (gold + silver + bronze) > 3)
  • We also provide an implementation for customInFilterValues to control which values are displayed in the In Filter - this is also handled on our mock server
  • We turn on Manually Applying Filters so that only one call to the server made with all selections
Try It Out
  • Run a Filter (e.g 3 in Gold column) and note how new data is fetched from the server that matches the Filter
  • Run the Superstar Custom Filter on the Athlete column and note how our mock server evaluates it and returns the correct data
  • Run the In Filter on the Athlete column and note how the server returns details of all athletes on the server (not just those already loaded)

Grid Filter

The Grid Filter can still be applied when using the Server-Side Row Model, but instead of AdapTableQL evaluating the Expression, it will be perfomed by developers on the server.

Hint

  • The Grid Filter can also include Custom Expression Functions provided by developers
  • These will also then need to be evaluated remotely in a bespoke implementation

Limiting Expression Complexity

By default AdapTable will provide every AdapTableQL Expression Functions in the Expression Editor.

This means bespoke server implementations will need to translate every Expression into something meaningful.

Accordingly, AdapTable allows developers to reduce Expression complexity in 2 ways in order to make the server implementation more manageable:

  • Limiting which Expressions are available (on a per Module basis if required)
  • Limiting which Columns can be included in a Query / Expression
SSRM - Grid Filter
Fork
  • The example shows how the AdapTable Grid Filter can still be used while using Server-Side Row Model
  • We include 2 Named Queries which are evaluated on our mock server (and accessible from dropdown at end of toolbar):
    • US Golds - returns rows where USA has > 1 gold
    • European Athletes - returns rows where country is in Europe (and uses a Custom Boolean Expression Function, FROM_EUROPE, that is also evaluated on our mock server)
  • We have provided a reduced set of AdapTableQL Expression Functions (for Grid Filter only) to make translating Expressions on the Server easier:
    • We pass a small, reduced, set of systemBooleanFunctions to Expression Options
    • For all the other types of Expression Functions we only allow COL (which references a column) to be used

Quick Search - to move

Deep Dive

How Does Quick Search Work?