<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic custom InfoWindow using arcgisUtils.createMap with webmap in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-infowindow-using-arcgisutils-createmap-with/m-p/467998#M43393</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings, I am working to extend the &lt;A href="https://developers.arcgis.com/javascript/3/jssamples/widget_extendInfowindow.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Custom info window&lt;/A&gt;&amp;nbsp;example to work with a webmap loaded using arcGISUtils.createMap. I'm not sure if loading the webmap changes or is missing some parameter that the map.infoWindow option needs to load a custom info window or if my logic is unsound. Regardless, a structure that is sound otherwise, fails produces an obscure error when I try to load a custom infoTemplate. The error that I am receiving is:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #222222; background-color: #fff0f0; margin-left: 4px;"&gt;&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:2377&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: red !important; background-color: #fff0f0;"&gt;Uncaught &lt;SPAN class="" style="font-size: 12px !important;"&gt;&lt;SPAN&gt;TypeError: d.clearFeatures is not a function at Object.Fa (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:2377&lt;/SPAN&gt;) at Object.c [as onClick] (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:119&lt;/SPAN&gt;) at Object._fire (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:1296&lt;/SPAN&gt;) at Object._fireClickEvent (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:1303&lt;/SPAN&gt;) at &lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:63&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts or suggestions will be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tyler&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The extended example that I am working&amp;nbsp;on is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
 &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&amp;gt;
 &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;
 &amp;lt;title&amp;gt;Custom Info Window&amp;lt;/title&amp;gt;
 &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/3.21/esri/css/esri.css"&amp;gt;
 &amp;lt;link rel="stylesheet" href="myModules/InfoWindow.css"&amp;gt;
 &amp;lt;style&amp;gt;
 html,
 body,
 #mapDiv {
 height: 100%;
 width: 100%;
 margin: 0;
 padding: 0;
 }
 &amp;lt;/style&amp;gt;
 &amp;lt;script&amp;gt;
 var dojoConfig = {
 parseOnLoad: true
 , packages: [{
 "name": "myModules"
 , "location": location.pathname.replace(/\/[^/]+$/, "") + "/myModules"
 }]
 };
 &amp;lt;/script&amp;gt;
 &amp;lt;script src="https://js.arcgis.com/3.21/"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;script&amp;gt;
 require([
 "dojo/dom"
 , "dojo/dom-construct"
 , "esri/map"
 , "esri/arcgis/utils"
 , "myModules/InfoWindow"
 , "esri/layers/FeatureLayer"
 , "esri/InfoTemplate"
 , "dojo/string"
 , "dojo/domReady!"
 ], function (dom, domConstruct, Map, arcgisUtils, InfoWindow, FeatureLayer, InfoTemplate, string) {
 //create the custom info window specifying any input options
 var infoWindow = new InfoWindow({
 domNode: domConstruct.create("div", null, dom.byId("mapDiv"))
 });
 //create the map and specify the custom info window as the info window that will
 //be used by the map
 var theme = {
 "layers": [
 {
 "url": "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Street_Trees/FeatureServer/0"
 , "visibility": true
 , "opacity": 1
 , "title": "Trees"
 , "id": "trees"
 , "outFields": ["*"]
 , "infoWindow":{
 "header": "${qSpecies}"
 , "content": "&amp;lt;b&amp;gt;Address:&amp;lt;/b&amp;gt;${qAddress}&amp;lt;br&amp;gt;"
 }
 }
 ]
 }
 var webmap = {}
 webmap = {
 "item": {
 "title": "trees"
 , "snippet": "Trees in London"
 }
 , "itemData": {
 "operationalLayers": [{}

 ]
 , "baseMap": {
 "baseMapLayers": [
 {
 "opacity": 1
 , "visibility": true
 , "url": "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
 }

 ]
 , "title": "London Treemap"
 }
 , "version": "1.1"
 }
 }
 
 var mapDeferred = arcgisUtils.createMap(webmap, "mapDiv", {
 mapOptions: {
 center: [-122.41, 37.78]
 , zoom: 17
 , slider: true
 , nav: false
 , smartNavigation: false
 , scrollWheelZoom: true
 , infoWindow: infoWindow
 }
 });
 mapDeferred.then(function (response) {
 map = response.map;
 //map.infoWindow = infoWindow

 function loadLayers(layerArray) {
 require(["esri/layers/FeatureLayer", "esri/InfoTemplate"], function (FeatureLayer, InfoTemplate) {
 //webmap.itemData.operationalLayers = [];
 //console.log("webmap.itemData.operationalLayers: " + JSON.stringify(webmap.itemData.operationalLayers))
 var fLayers = [];
 for (var i = 0; i &amp;lt; layerArray.length; i++) {
 var layer = layerArray&lt;I&gt;;
 //for (var property in layer) {
 //console.log('item ' + i + ': ' + property + '=' + layer[property]);
 var fLayer;
 if (layer.infoWindow) {
 var iwHeader = layer.infoWindow.header;
 var iwContent = layer.infoWindow.content;
 console.log(iwHeader);
 console.log(iwContent);
 var template = new InfoTemplate(iwHeader, iwContent);
 console.log(template);
 fLayer = new FeatureLayer(layer.url, {
 mode: FeatureLayer.MODE_ONDEMAND
 , id: layer.id
 , outFields: layer.outFields
 , opacity: layer.opacity
 , visibility: layer.visibility
 , infoTemplate: template
 })
 }
 else {
 fLayer = new FeatureLayer(layer.url, {
 mode: FeatureLayer.MODE_ONDEMAND
 , id: layer.id
 , outFields: layer.outFields
 , opacity: layer.opacity
 , visibility: layer.visibility
 })
 }
 fLayers.push(fLayer);
 }
 map.addLayers(fLayers);
 });
 }
 loadLayers(theme.layers)
 
 //resize the info window
 map.infoWindow.resize(180, 75);
 });
 
 });
 &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
 &amp;lt;div id="mapDiv"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&amp;nbsp;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:31:00 GMT</pubDate>
    <dc:creator>TylerWaring</dc:creator>
    <dc:date>2021-12-12T16:31:00Z</dc:date>
    <item>
      <title>custom InfoWindow using arcgisUtils.createMap with webmap</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-infowindow-using-arcgisutils-createmap-with/m-p/467998#M43393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings, I am working to extend the &lt;A href="https://developers.arcgis.com/javascript/3/jssamples/widget_extendInfowindow.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Custom info window&lt;/A&gt;&amp;nbsp;example to work with a webmap loaded using arcGISUtils.createMap. I'm not sure if loading the webmap changes or is missing some parameter that the map.infoWindow option needs to load a custom info window or if my logic is unsound. Regardless, a structure that is sound otherwise, fails produces an obscure error when I try to load a custom infoTemplate. The error that I am receiving is:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #222222; background-color: #fff0f0; margin-left: 4px;"&gt;&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:2377&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: red !important; background-color: #fff0f0;"&gt;Uncaught &lt;SPAN class="" style="font-size: 12px !important;"&gt;&lt;SPAN&gt;TypeError: d.clearFeatures is not a function at Object.Fa (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:2377&lt;/SPAN&gt;) at Object.c [as onClick] (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:119&lt;/SPAN&gt;) at Object._fire (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:1296&lt;/SPAN&gt;) at Object._fireClickEvent (&lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:1303&lt;/SPAN&gt;) at &lt;SPAN class="" style="color: #545454; text-decoration: underline;"&gt;init.js:63&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts or suggestions will be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tyler&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The extended example that I am working&amp;nbsp;on is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
 &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&amp;gt;
 &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;
 &amp;lt;title&amp;gt;Custom Info Window&amp;lt;/title&amp;gt;
 &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/3.21/esri/css/esri.css"&amp;gt;
 &amp;lt;link rel="stylesheet" href="myModules/InfoWindow.css"&amp;gt;
 &amp;lt;style&amp;gt;
 html,
 body,
 #mapDiv {
 height: 100%;
 width: 100%;
 margin: 0;
 padding: 0;
 }
 &amp;lt;/style&amp;gt;
 &amp;lt;script&amp;gt;
 var dojoConfig = {
 parseOnLoad: true
 , packages: [{
 "name": "myModules"
 , "location": location.pathname.replace(/\/[^/]+$/, "") + "/myModules"
 }]
 };
 &amp;lt;/script&amp;gt;
 &amp;lt;script src="https://js.arcgis.com/3.21/"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;script&amp;gt;
 require([
 "dojo/dom"
 , "dojo/dom-construct"
 , "esri/map"
 , "esri/arcgis/utils"
 , "myModules/InfoWindow"
 , "esri/layers/FeatureLayer"
 , "esri/InfoTemplate"
 , "dojo/string"
 , "dojo/domReady!"
 ], function (dom, domConstruct, Map, arcgisUtils, InfoWindow, FeatureLayer, InfoTemplate, string) {
 //create the custom info window specifying any input options
 var infoWindow = new InfoWindow({
 domNode: domConstruct.create("div", null, dom.byId("mapDiv"))
 });
 //create the map and specify the custom info window as the info window that will
 //be used by the map
 var theme = {
 "layers": [
 {
 "url": "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Street_Trees/FeatureServer/0"
 , "visibility": true
 , "opacity": 1
 , "title": "Trees"
 , "id": "trees"
 , "outFields": ["*"]
 , "infoWindow":{
 "header": "${qSpecies}"
 , "content": "&amp;lt;b&amp;gt;Address:&amp;lt;/b&amp;gt;${qAddress}&amp;lt;br&amp;gt;"
 }
 }
 ]
 }
 var webmap = {}
 webmap = {
 "item": {
 "title": "trees"
 , "snippet": "Trees in London"
 }
 , "itemData": {
 "operationalLayers": [{}

 ]
 , "baseMap": {
 "baseMapLayers": [
 {
 "opacity": 1
 , "visibility": true
 , "url": "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
 }

 ]
 , "title": "London Treemap"
 }
 , "version": "1.1"
 }
 }
 
 var mapDeferred = arcgisUtils.createMap(webmap, "mapDiv", {
 mapOptions: {
 center: [-122.41, 37.78]
 , zoom: 17
 , slider: true
 , nav: false
 , smartNavigation: false
 , scrollWheelZoom: true
 , infoWindow: infoWindow
 }
 });
 mapDeferred.then(function (response) {
 map = response.map;
 //map.infoWindow = infoWindow

 function loadLayers(layerArray) {
 require(["esri/layers/FeatureLayer", "esri/InfoTemplate"], function (FeatureLayer, InfoTemplate) {
 //webmap.itemData.operationalLayers = [];
 //console.log("webmap.itemData.operationalLayers: " + JSON.stringify(webmap.itemData.operationalLayers))
 var fLayers = [];
 for (var i = 0; i &amp;lt; layerArray.length; i++) {
 var layer = layerArray&lt;I&gt;;
 //for (var property in layer) {
 //console.log('item ' + i + ': ' + property + '=' + layer[property]);
 var fLayer;
 if (layer.infoWindow) {
 var iwHeader = layer.infoWindow.header;
 var iwContent = layer.infoWindow.content;
 console.log(iwHeader);
 console.log(iwContent);
 var template = new InfoTemplate(iwHeader, iwContent);
 console.log(template);
 fLayer = new FeatureLayer(layer.url, {
 mode: FeatureLayer.MODE_ONDEMAND
 , id: layer.id
 , outFields: layer.outFields
 , opacity: layer.opacity
 , visibility: layer.visibility
 , infoTemplate: template
 })
 }
 else {
 fLayer = new FeatureLayer(layer.url, {
 mode: FeatureLayer.MODE_ONDEMAND
 , id: layer.id
 , outFields: layer.outFields
 , opacity: layer.opacity
 , visibility: layer.visibility
 })
 }
 fLayers.push(fLayer);
 }
 map.addLayers(fLayers);
 });
 }
 loadLayers(theme.layers)
 
 //resize the info window
 map.infoWindow.resize(180, 75);
 });
 
 });
 &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
 &amp;lt;div id="mapDiv"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&amp;nbsp;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:31:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-infowindow-using-arcgisutils-createmap-with/m-p/467998#M43393</guid>
      <dc:creator>TylerWaring</dc:creator>
      <dc:date>2021-12-12T16:31:00Z</dc:date>
    </item>
  </channel>
</rss>

