AnsweredAssumed Answered

Web App Builder Click on Feature to open URL

Question asked by johndye on May 23, 2018
Latest reply on May 23, 2018 by rscheitlin

We have an app that we built with Web App Builder along with some custom LayerList and Swipe widgets. One of the requirements we got this morning is that instead of showing a popup with a Hyperlinked URL when a user clicks on a feature in the web map, the customer just wants to skip the popup behavior altogether and click on features to open the URL.


I found a GeoNet Post by jai siva which gives me some good starting code:


  1. var map;  
  3.       require(["esri/map",  
  4.                 "esri/layers/FeatureLayer",  
  5.                 "esri/InfoTemplate",  
  6.                 "dojo/on",  
  7.                 "dojo/domReady!"],   
  8.   function(Map,FeatureLayer,InfoTemplate,on) {  
  9.           map = new Map("map", {  
  10.           basemap: "topo",  //For full list of pre-defined basemaps, navigate to  
  11.           center: [00// longitude, latitude          
  12.         });  
  14.   var featureLayer = new FeatureLayer("");  
  15.   map.addLayer(featureLayer);  
  17.   //Code for the specific URL to open in a new window  
  18.   featureLayer.on('click',function(e){   
  19.     var specific = e.graphic.attributes['SpecificAttribute']   
  21.   });  
  22.       });  


However, since this is going to be in a custom Web App Builder App, I'm having trouble finding the best place to drop the code. I've tried at init.js, simpleLoader.js and jimu.js/MapManager.js but haven't had any luck. Any ideas on the best place and/or way to accomplish this?