AnsweredAssumed Answered

JS Search Widget - multiple fields is not working for me

Question asked by vishesh on May 14, 2015
Latest reply on May 14, 2015 by vishesh

I am trying to customize ESRI JS API 3.13 Search widget with custom featurelayers and fields on WAB. However, it seems the search is only picking the default field and ignores others.

 

sources=[{}], //contains featurelayer url, name and fields

 

//load ESRI new SEARCH =========================================================

var s = new Search({

                    showSuggestions: true,

                    enableLabel: false,

                    enableInfoWindow: true,

                    showInfoWindowOnSelect: false,

                    map: this.map

                    }, "esriSearch");

 

                    var sources = s.get("sources");

                 

                    //loop over each layer and add to sources for Search

                    array.forEach(this.searches, lang.hitch(this, function(sItems, l)

                    {

                        if(sItems.fURL){                          

                            try

                            {                              

                                sources.push({

                                    featureLayer: new FeatureLayer(sItems.fURL),

                                    searchFields: sItems.fields,

                                    outFields: ["*"],                                 

                                    exactMatch: false,

                                    name: sItems.fName

                                });

                            }

                            catch (error){

                               console.log(error);

                            }

                        }                   

                

                    }));

Outcomes