Search Widget on 3.21

813
5
09-13-2017 02:02 PM
SeanPhayakapong2
New Contributor II

Am I missing something for my Search Widget? I am trying to customize the widget to search feature layers, but it only recognizes Integers and not String values. I believe my problem stems from my organization's configuration of its REST server. Any help is appreciated. I am running this in CMV 2.0.0beta2

define([

      'esri/tasks/locator',

      'esri/dijit/Search',

      'esri/layers/FeatureLayer',

      'esri/InfoTemplate',

      'dojo/has',

      'dojo/domReady!'

], function (Locator, Search, FeatureLayer, InfoTemplate, has) {

return {

   map: true,

   mapRightClickMenu: true,

   enableInfoWindow: true,

   enableButtonMode: has('mobile') ? false : true,

   expanded: true,

   enableSuggestions: true,

   allPlaceholder: 'Find an address or APN',

         sources: [{

            placeholder: 'Find an address',

            locator: new Locator('http://gis.ci.oceanside.ca.us/gis/rest/services/AddressLocator_Composite2016/GeocodeServer'),

            singleLineFieldName: 'SingleLine',

            outFields: ['Loc_name'],

            name: 'Address Search',

            localSearchOptions: { minScale: 300000, distance: 50000 }

}, {

            featureLayer: new FeatureLayer('http://gis.ci.oceanside.ca.us/gis/rest/services/WebService/Parcel/MapServer/0'),

            searchFields: ["APN"],

            name: "Assessor's Parcel Number",

            displayField: "APN",

            exactMatch: false,

            outFields: ["*"],

            placeholder: 'APN - ex 1470950400',

            maxResults: 6,

            maxSuggestions: 6,

            minCharacters: 0,

            infoTemplate: new InfoTemplate("Search result", "APN: ${APN}"),

    }] };

});

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

You would probably be better off have this question in the https://community.esri.com/groups/cmv?sr=search&searchId=98b152a5-0997-4a19-a16a-76d8ffce0bab&search...‌ group

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

I will move it.

0 Kudos
TimMcGee1
Occasional Contributor III

While the application is using CMV, the configuration is for the Esri Search widget which can be used within CMV and elsewhere. You can test your Feature Layer(s) and Locator using this sandbox example for the Search widget: ArcGIS API for JavaScript Sandbox

SeanPhayakapong2
New Contributor II

Yes, that is why I did not put this in the CMV group. I think this is more of my organization's REST server, since I plugged in other REST servers's parcel data and they worked fine with the exact same code. I just do not know how to proceed within my organization/server setting.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

My apologies for moving it too quickly.  You can move it back (or I can if needed).  Remember you can all tag other groups with the @ and the space/group name.