Add a filter for the suggestion's field

#1

Hello,

I have a Text field with a list of suggestion ( List of facilities) when we type into the field.
I need to show only a specific type of facility. (the main => means parent field empty)
How can I add this filter ?

Here is the current code:

                {
                     "label": "{~Enterprise.FacilitiesFilter.FacilityName.text~}",
                     "component": "ControlGroup",
                     "comparator" : "startsWith",
                     "field": {
                         "component": "field.Text",
                         "id": "buildingNameAnswer",
                         "name": "buildingNameAnswer",
                         "typeahead" : {
                             "c3module" : "facilitymgt",
                             "c3type" : "Facility"
                         },
                         "ignorePageRecord": true
                     }
                 },

Thanks …
Samad.

0 Likes

#2

Starting in the v7.5 release you can add an additionFilter config into the typeahead config. This will allow you to supply an additional filter string to be applied.

"typeahead" : {
                             "c3type" : "FakeExampleType",
                             "additionFilter" : "fakeExampleField == exampleValue"
                         },

(It’s also worth noting that in v7.5, “c3module” is no longer needed)

0 Likes

#3

Can you “typeahead” on any other field on a Type besides the name field?

0 Likes

#4

@ColumbusL Typeahead searches the field specified in the searchName config—if that is not set, it uses the name config. In @Dev’s original example, the field of Facility being used for typeahead search is buildingNameAnswer because searchName is not set, but name is.

0 Likes