AnsweredAssumed Answered

JSAPI - Getting "Type Error a.toLowerCase is not a function" with Search

Question asked by agelfert on Aug 27, 2020
Latest reply on Sep 17, 2020 by agelfert

So there is nothing worse, I find, than wanting to reuse some code you have successfully deployed in once place and not getting it work elsewhere. I'm running into this with using Search (JSAPI 3,x) in my latest custom widget for WAB 2.16.


It's a simple search with suggestions that I'm recycling. Gave it a new name and hooked it into a new service but it bombs when trying to return suggestions. This is what I'm doing, maybe someone spots my obvious mistake.


// plugged in the widget.html, I have

<div data-dojo-attach-point="searchWithSuggestions" id="searchWithSuggestions"></div>

Then I do this in Javascript...

// widget.js

startup : function() {
[ ... ]

var searchUrl = "https://.....Mapserver/1 ";

var searchSources = [
        {featureLayer: new FeatureLayer(searchUrl),
         name: 'Layer 1',
         outFields: ["*"],
         displayField: ["NAME"],
         searchFields: ["NAME"],
         suggestionTemplate: "${NAME}",
         enableSearchingAll: false,
         enableSuggestions: true,
         exactMatch: false,
         minCharacters: 3

this.searchWithSuggestions = new Search({
        sources: searchSources,
        popupEnabled: false,
        autoSelect: false,
        enableSourcesMenu: false,
        enableSuggestions: true,
        maxSuggestions: 5,
        allPlaceholder: "enter your search here",
        autoNavigate: false
}, "searchWithSuggestions");



Search widget shows up in widget. But when i start typing and get past 3 characters (minCharacters), it fails with 


So something clearly is not right with the suggestions. I've checked the map service and it supports pagination. Something wrong with my code, something else I need to check ?