AnsweredAssumed Answered

Search widget locator filter

Question asked by agole_waterboards on Sep 11, 2018
Latest reply on Sep 11, 2018 by agole_waterboards

Hi all,

 

I am using the ArcGIS Javascript 4.x and try to apply the filter in the documentation but I am not getting it to work. I want the suggested results to be only "California".

 

 

Code is here. 

//Search widget here
            var searchWidget = new Search({
                view: view,
                popupEnabled: false,
                popupOpen: false,
                resultGraphicEnabled: false,
                includeDefaultSources: false,
               
                sources: // Default sources[] when sources is not specified
                [
                    {
                        locator: new Locator({ url: "//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer" }),
                        singleLineFieldName: "SingleLine",
                        outFields: ["Addr_type"],
                        name: "ArcGIS World Geocoding Service",
                        placeholder: "Enter an address",
                        resultSymbol: {
                            type: "picture-marker",  // autocasts as new PictureMarkerSymbol()
                            url: this.basePath + "/images/search/search-symbol-32.png",
                            size: 24,
                            width: 24,
                            height: 24,
                            xoffset: 0,
                            yoffset: 0
                        },
                        filter: "State =" + "'" + "California" + "'",
                    }
                ]
            }, "search");

Any idea?

Outcomes