I migarate from 4.11 to 4.12, after migration my search widget can not auto navigate to results!! why?
By default autoSelect is enabled and the search will select and zoom to the first geocoded result. It works in the sample: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=widgets-search...
Do you have a reproducible bit of code that shows what you are seeing?
var searchWidget = new Search({
view: view,
allPlaceholder: "search...",
sources: [{
layer: new FeatureLayer({
url: "localhost:6080/arcgis/rest/services/city/FeatureServer/0",
outFields: ["*"],
}),
searchFields: ["city"],
displayField: "city",
exactMatch: false,
outFields: ["city", "local"],
name: "city1",
placeholder: "search city...",
autoNavigate: true,
maxResults:10,
maxSuggestions:50,
enableSuggestions: true
},
autoNavigate is true by default so you shouldn't have to set it if you want true. I tested both true and false using this sample and got the expected behavior in both 4.11 and 4.12.
Hi
I,m working on 3d view, but your sample is on 2d. I tested your code with my sample and can not zoom on results! why?
I think arcgis java script 4.12 has too many bugs!! There is not any solution??
Hi
When I use search widget it return this error in browser console:
[esri.views.3d.state.ViewStateManager] #goTo() Failed to create camera from target, no layerview has been found for the layer
I submitted a bug for this issue to the dev team. At this point I'm not aware of a workaround but if I discover one I'll reply back here and let you know.
It looks like goTo fails when it is trying to navigate to a graphic that is not in the map. So one potential workaround = if it works for your use case - would be to add the search layers to the map. Here's an updated example:
Like Kelly said, this is a bug on our side and we'll work on a fix for 4.13. In the meantime a possible workaround is to add the layer to the map like Kelly suggested.