AnsweredAssumed Answered

How to add Feature Layer created programtically using feature Layer Defination to Search widget in WAB

Question asked by AVTSPositioning on Mar 20, 2017
Latest reply on Mar 21, 2017 by rscheitlin

I have created a feature layer given on in custom widget.  I tried to bind the programmatically created Feature layer with ESRI search widget. Here is my code

    var widgets = this.appConfig.getConfigElementsByName('Search');
   var searchWidget =this.widgetManager.getWidgetById(widgets[0].id);
   var src =
                               featureLayer: featureLayer,
                               searchFields: ["ObjectId"],
                               displayField: "Name",
                               exactMatch: false,
                               outFields: ["*"],                               
                               suggestionsEnabled: true,
                               locator: new Locator("//"),
                               singleLineFieldName: "SingleLine",
                               outFields: ["Addr_type"],
                               name: "Adress"
                           ];  //new source
                    searchWidget.sources = src;   




The layer doesn't appear in search widget.


Thanks in advance.