Custom filters in c8y-data-grid

Hi,

We’re using Cumulocity 1018.0.457 with Angular 14.

We have a grid with columns containing the following data:

  • Start time – formatted date
  • End time – formatted date
  • State – enum type
  • Duration – formatted number

Currently, we’ve added the filterable: true parameter to each column, which enables the default “Filter text” option. However, this default is not well-suited to the types of data we’re displaying.

In the tutorial for the 1018 version of Cumulocity, I found a device grid using custom validators for filters (based on Formly documentation).
In the code, I only see the line:

const columns = this.deviceGridService.getDefaultColumns();

—but I couldn’t find the implementation of getDefaultColumns().
Are there any available examples of how to implement custom filters?

The filtering behavior I want to implement:

Any help or pointers would be much appreciated. Thanks in advance!

Hi @patrycja.dembinska,

You would need to prvoide the filteringConfig ( Web SDK documentation ) or filteringFormRendererComponent ( Web SDK documentation ) in order to customize the filter.

I haven’t checked the 1018 version of the tutorial application, but the recent versions of the tutorial app include samples for this: Code search results · GitHub

Please also consider upgrading to a more recent version of the Web SDK. The last 1018.0.x version of the Web SDK (1018.0.278) was almost a year ago..

Regards,
Tristan