I am using Arcgis API for Javascript version 4.21.2.
My problem is that I cannot search my feature layers columns that are declared as esriFieldTypeDouble. The declaration has been made in my Mapserver and therefore I can't change the typing. Numbers, declared as esriFieldTypeString can be used in the search, for example ID is a string.
How is it possible to search these columns by using the Search Widget?
Are you using the search widget? If so, this should work just fine. Here is an example from the current version (4.24). Try out the Census Block Group locator, which searches on a esriFieldTypeDouble field.
https://codepen.io/noash/pen/qBYbMXd?editors=1000
I am using the search widget. I also updated my version to the current version 4.24.
Here is a snippet on how I create a search source. I even modified it that only the coordinate (an esriFieldTypeDouble) is the only searchable field.
function addToSearchSources(featureLayer: FeatureLayer) {
const searchSource = new LayerSearchSource({
layer: featureLayer,
searchFields: ['NORTHING_ORIGINAL'],
displayField: featureLayer.displayField,
exactMatch: false,
outFields: ["*"],
name: featureLayer.title,
placeholder: featureLayer.title,
suggestionsEnabled: true,
})
console.log('searchSource.searchFields', searchSource.searchFields)
search.sources.add(searchSource);
}
The logging returns the correct value, NORTHING_ORIGINAL which is a double. But for some reason I am not able to use columns with double values in search.