AnsweredAssumed Answered

ESRI Search Widget activeSourceIndex Usage

Question asked by on Sep 15, 2018
Latest reply on Sep 16, 2018 by rscheitlin

I am looking for some example of setting the default search service to all(feature layer and esri geocoding).  but I also care about the order of the results returned.


I suspect this is accomplished using the activeSource parameter of the search widget. But have not been able to find an example of this implemented.


I have tried implementing like this..


var searchWidget = new Search({    container: "searchDiv",    view: view,    allPlaceholder: "Places or Tyler Communities",    activeSource: 0,    sources: [{        featureLayer: {            url: "",            popupTemplate: { // autocasts as new PopupTemplate()                title: "{customer} is  Tyler Connected Community!",                overwriteActions: true            }        },        activeSourceIndex: 1,        searchFields: ["customer", "city", "state"],        displayField: "customer",        exactMatch: false,        outFields: ["*"],        name: "Tyler Communities",        placeholder: "example: city of birmingham",        zoomScale: 500000    }]});

and also like this...


searchWidget.activeSource = 0;

But both return this error...


dojo.js:340 Uncaught TypeError: [accessor] cannot assign to read-only property 'activeSource' of esri.widgets.Search.SearchViewModel


Any help is greatly appreciated.