AnsweredAssumed Answered

Search widget not suggesting/ not displaying any result from feature layer

Question asked by reneeshktsd on Jul 11, 2019
Latest reply on Jul 12, 2019 by NSager-esristaff

I have displayed a map using webmap and now trying to implement the search.. but it is not doing search in the feature layer.. What is wrong I am doing?

 

const testLayer = map.allLayers.find(function(layer) {
return layer.title === "mytestlayer";
});

var searchWidget = new Search({

view: view,
allPlaceholder: "Search",
sources: [
{
layer: testLayer,
searchFields: ["myfield"],
suggestionTemplate: "{myfield}",
exactMatch: false,
outFields: ["*"],
name: "testing",
placeholder: "example: test"
}
]
});

view.ui.add(searchWidget, {
position: "top-right"
});
});

Outcomes