Skip to main content
Skip table of contents

Extending Selectors

For every Model you can add custom selectors

In FrontedModel

TYPESCRIPT
  static dynamicFilters: Array<{ key: string; func: FilterFunc }> = [
    {
      key: 'active$',
      func: (entities: TireGuarantee[]) => {
        const twoYearsAgo = moment().subtract(2, 'years');
        return entities.filter(
          (entity) =>
            moment(entity.purchase_date).isAfter(twoYearsAgo) &&
            entity.damageReports &&
            entity.damageReports.length === 0
        );
      },
    },
  ];
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.