Skip to content

Show Additional Fields on Pop Ups

Seth edited this page Aug 17, 2018 · 5 revisions

You cannot change the results that are shown in the pick lists, but what you can do is add additional fields to the final pop up displayed when you select an individual result.

In the screenshot below we are showing the UPRN field for the returned address. uprn

To show additional fields you will need to make some modifications to the Drilldown Widget code, these changes need to be made to the Widget.js file found in the Drilldown folder. Find the application folder that you wish to modify and then find the Drilldown widget folder, e.g. server/apps//widgets/Drilldown

  1. In the Widget.js file find the bit of code where the Drilldown widget is created, it will look like this:
this.drilldownDijit = new Drilldown({
    activeSourceIndex: searchSouces.length === 1 ? 0 : 'all',
    autoSelect: false,
    enableSuggestions: false,
    enableButtonMode: false,
    enableLabel: false,
    enableInfoWindow: true,
    showInfoWindowOnSelect: true,
    map: this.map,
    sources: searchSouces,
    theme: 'arcgisSearch'
});
  1. Modify this block and add in the infoTemplate, infoTemplate: new InfoTemplate("Attributes", "Address: ${Match_addr}<br>UPRN: ${UPRN}") The code should then look like this with the new infoTemplate line:
   this.drilldownDijit = new Drilldown({
        activeSourceIndex: searchSouces.length === 1 ? 0 : 'all',
        autoSelect: false,
        enableSuggestions: false,
        enableButtonMode: false,
        enableLabel: false,
        enableInfoWindow: true,
        showInfoWindowOnSelect: true,
        map: this.map,
        sources: searchSouces,
        theme: 'arcgisSearch',
        infoTemplate: new InfoTemplate("Attributes", "Address: ${Match_addr}<br>UPRN: ${UPRN}") 
 });
  1. You will also need to import the InfoTemplate class by adding it to the define list at the top of the file. Go to the top of the Widget.js file and find the define section. It will look similar to this:

define

  1. Add in the InfoTemplate to the define, you can add it in as the first entry. define(['esri/InfoTemplate','dojo/_base/declare',
  2. Add the InfoTemplate to the function parameters in the same position as you added it into the define list. function (InfoTemplate, declare,

You should now get the UPRN displaying in the address results pop up. You can add in other fields using the ${} syntax by putting the field name inside the brackets.