AnsweredAssumed Answered

Search multiple sources - Format using infoTemplate for More Search Results

Question asked by ravicyient on Jun 30, 2015
Latest reply on Apr 12, 2016 by MDriscoll-esristaff

While using the Search Multiple Sources widget provided in the ArcGIS API for JavaScript Latest Samples

 

Search multiple sources | ArcGIS API for JavaScript

 

In this widget we have an observation on the search results return using the infoTemplate().

 

Where ever we use the sources as

 

sources.push({
            featureLayer: new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/CongressionalDistricts/FeatureServer/0"),
            searchFields: ["DISTRICTID"],
            displayField: "DISTRICTID",
            exactMatch: false,
            outFields: ["DISTRICTID", "NAME", "PARTY"],
            name: "Congressional Districts",
            placeholder: "3708",
            maxResults: 6,
            maxSuggestions: 6,
            //Create an InfoTemplate and include three fields
            infoTemplate: new InfoTemplate("Congressional District", "District ID: ${DISTRICTID}</br>Name: ${NAME}</br>Party Affiliation: ${PARTY}"),
            enableSuggestions: true,
            minCharacters: 0
         });

 

In the Line #12  we could see the info template has been configured.

and this going to return us the results in the below format:

 

Infotempalte-Default.jpg

 

and when we customize the Info template as below as

         sources.push({
            featureLayer: new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/CongressionalDistricts/FeatureServer/0"),
            searchFields: ["DISTRICTID"],
            displayField: "DISTRICTID",
            exactMatch: false,
            outFields: ["DISTRICTID", "NAME", "PARTY"],
            name: "Congressional Districts",
            placeholder: "3708",
            maxResults: 6,
            maxSuggestions: 6,
            //Create an InfoTemplate and include three fields
            infoTemplate: new InfoTemplate("", ""),
            enableSuggestions: true,
            minCharacters: 0
         });

 

In the Line #12  we could see the info template has been configured to default which are null.

and this going to return us the results in the below format:

 

Infotempalte-null.jpg

 

 

 

Here my query is can we customize the info Template to show the certain attributes and Show more results as like in the image#2.

 

So I am expecting the results to be in the below format

 

 

DistrictID
Name
Party
3705Virginia Fox

 

republican

3706xxxxxxxxxx

 

Where when user clicks on the DistrictID it navigate to the respective district.

 

 

Can some one please help in getting this designed ?

 

Did some one have seen this before ?

 

 

Robert Scheitlin, GISP

TAPAS DAS

Stan McShinsky

Outcomes