How to dynamically set value on a default or user filter on Record Type?

Certified Senior Developer

Hi,

I'm trying to access a RecordType I've created in an interface.

To do this, I've created my Gridfield and added all the RecordType columns. I did the same with index.
Now, that the grid is well displayed, is there any way to set the value of default filters or user filters?

or enable/disable one of them please?

I find it hard to imagine that my RecordType grid can be filtered only by a manual user action... I hope not.

Any help would be greatly appreciated.

Regards

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    For example, I've created a Contracts RecordType with default filter "contract_code".

    Now I open my Interface (where I've created a GridField based on the RecordType), and then I would like to set a default value for a user filter, something like this :

    (but I do not want to manually interact with the RecordType)

    a!gridField {
      data: recordType!RR_Contract,
      columns : { ... },
      
      userFilters: {
          recordType!RR_Contracts.filters.contractCode
          recordType!RR_Contracts.filters.contractCode.defaultValue = "00000002"
         
    or :
    
      filter: filter(
          field: "contract_code",
          operator: "=",
          value: "00000002"
      ...
    }

Children