Adding isFilterable on smart collection with smart relationship

Feature(s) impacted

isFilterable on collection fields doesnt add the filter button if the field type is from type “string”

Observed behavior

Hey,

I have a smart collection which is displayed on via smart relationship in our forest admin.

So far I’ve added isFilterable for fields that are from Enum types with no issue, and off-course the implantation was made in the route file of the parent collection after extracting the filtering params from the actual request ( i.e request.query.filters).

{
      field: 'status',
      type: 'Enum',
      enums: Object.values(StepStatus),
      isFilterable: true
    },

While adding the isFilterable property to string type field , I could not see the filter icon in the head of the columns

{
      field: 'topic',
      type: 'String',
      isFilterable: true
    }

Expected behavior

Filter icon should be displayed in related column, so the param would be extracted in the relationship route.

is there something I am missing in this context?

worth mentioning , the smart relationship route is the one in charge of loading the data.

Context

  • Project name: Empathy
  • Team name: Empathy
  • Environment name: development
  • Agent type & version: express
  • Recent changes made on your end if any: …

Hi @RonenMeiri,

Do you have the isFilterable: true in your .forestadmin-schema.json for this field ?

@vince Yes. I can see the change was reflected in schema

but no filter indication in column header as I see in the Enum field type.

OK, found the solution.

So apparently in some ( unknown to me ) case, filtering should be also enabled in the UI edit layout field option.

Actually it shoudl always be enabled in the UI. But by default it’s enabled the first time you launch your app and then everything you will add afterward will be deactivated

@vince OK Got it.

I don’t know if this requires a different thread,

But I’m having trouble to adding sorting control icons as we have table models, I saw I can add isSortable to field but the sorting could only be controlled in the collection preferences :

Am I missing something with configuration ?

Thanks

Hey @RonenMeiri,

yes sorry, could you please create a new thread :sweat_smile: ?

sure, thanks a lot !

1 Like