<?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 Re: Set infoWindow title with html element in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521401#M48605</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the template objects class type?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Dec 2016 14:38:14 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2016-12-22T14:38:14Z</dc:date>
    <item>
      <title>Set infoWindow title with html element</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521398#M48602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to add an combobox to the title of an infoWindow. The combobox is intended to be populated with the list of identified results. I'm trying two different ways:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Adding the combobox declaratively using html:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var template = new esri.InfoTemplate(layerName + "&amp;lt;br/&amp;gt;&amp;lt;select id="id_select" data-dojo-type="dijit/form/Select"&amp;lt;/select&amp;gt;,"&amp;lt;br/&amp;gt; FID : ${FID}");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The combobox is there, but I don't know how to access the combobox to add the options dynamically (via addOptions). I would normally do dijit.byId("id_select"), but considering it doesn't exist until it's created...I'm not sure how to go about this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Programmatically&lt;/P&gt;&lt;P&gt;With the code below, the title displays&amp;nbsp;information regarding the dijit/form/select widget (It displays: [object HTML TableElement]), but not the widget itself. I tried using domConstruct like this&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jssamples/widget_infowindowchart.html" rel="nofollow noopener noreferrer" target="_blank"&gt;example&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var identifyTask, identifyParams, idPoint;
var identifyResults;

require([
 "esri/dijit/Popup",
 "esri/tasks/IdentifyTask",
 "esri/tasks/IdentifyParameters",
 "dijit/form/Select",
 "dojo/dom-construct",
 "dojo/promise/all",
 "dojo/domReady!"
], function (
 Popup, IdentifyTask, IdentifyParameters, Select, domConstruct, All
) {
 var identifySelect;

//dojo.connect(window.myMap, "onLoad", mapReady);
 mapReady(window.myMap);

function mapReady(map) {
 dojo.connect(window.myMap, "onClick", runIdentifies);
 }

function runIdentifies(evt) {
 identifyResults = [];
 idPoint = evt.mapPoint;
 var layers = dojo.map(window.myMap.layerIds, function (layerId) {
 return window.myMap.getLayer(layerId);
 });
 layers = dojo.filter(layers, function (layer) {
 if (layer.visibleLayers[0] !== -1) {
 return layer.getImageUrl &amp;amp;&amp;amp; layer.visible
 }
 }); //Only dynamic layers have the getImageUrl function. Filter so you only query visible dynamic layers
 var tasks = dojo.map(layers, function (layer) {
 return new IdentifyTask(layer.url);
 }); //map each visible dynamic layer to a new identify task, using the layer url
 var defTasks = dojo.map(tasks, function (task) {
 return new dojo.Deferred();
 }); //map each identify task to a new dojo.Deferred
 var params = createIdentifyParams(layers, evt);

var promises = [];

for (i = 0; i &amp;lt; tasks.length; i++) {
 promises.push(tasks&lt;I&gt;.execute(params&lt;I&gt;)); //Execute each task
 }

var allPromises = new All(promises);
 allPromises.then(function (r) { showIdentifyResults(r, tasks); });
 }

function showIdentifyResults(r, tasks) {
 var results = [];
 var taskUrls = [];
 var resultNames = [];


 r = dojo.filter(r, function (result) {
 return r[0];
 });
 for (i = 0; i &amp;lt; r.length; i++) {
 results = results.concat(r&lt;I&gt;);
 for (j = 0; j &amp;lt; r&lt;I&gt;.length; j++) {
 taskUrls = taskUrls.concat(tasks&lt;I&gt;.url);
 }
 }
 results = dojo.map(results, function (result, index) {
 var feature = result.feature;
 var layerName = result.layerName;
 var serviceUrl = taskUrls[index];

resultNames.push({
 value: result.layerName,
 label: result.layerName
 });
 feature.attributes.layerName = result.layerName;

var identifiedList = getIdentifiedList(resultNames);
 console.log(identifiedList);

var template = new esri.InfoTemplate();
 template.setTitle(identifiedList);
 feature.setInfoTemplate(template);

var resultGeometry = feature.geometry;
 var resultType = resultGeometry.type;
 return feature;
 });


 if (results.length === 0) {
 window.myMap.infoWindow.clearFeatures();
 } else {
 window.myMap.infoWindow.setFeatures(results);
 }


 window.myMap.infoWindow.show(idPoint);

identifySelect.on('change', function(evt) {
 var identIndex = identifySelect.get("value");
 console.log(identIndex);
 window.myMap.infoWindow.select(identIndex);
 });

return results;
 }

function getIdentifiedList(options) {
 identifySelect = new Select({
 name: "identifySelect",
 id: "id_select",
 options: options
 }, domConstruct.create("select"));
 return identifySelect.domNode;
 }

function createIdentifyParams(layers, evt) {
 var identifyParamsList = [];
 identifyParamsList.length = 0;
 dojo.forEach(layers, function (layer) {
 var idParams = new esri.tasks.IdentifyParameters();
 idParams.width = window.myMap.width;
 idParams.height = window.myMap.height;
 idParams.geometry = evt.mapPoint;
 idParams.mapExtent = window.myMap.extent;
 idParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
 var visLayers = layer.visibleLayers;
 if (visLayers !== -1) {
 var subLayers = [];
 for (var i = 0; i &amp;lt; layer.layerInfos.length; i++) {
 if (layer.layerInfos&lt;I&gt;.subLayerIds == null)
 subLayers.push(layer.layerInfos&lt;I&gt;.id);
 }
 idParams.layerIds = subLayers;
 } else {
 idParams.layerIds = [];
 }
 idParams.tolerance = 5;
 idParams.returnGeometry = true;
 identifyParamsList.push(idParams);
 });
 return identifyParamsList;
 }

});&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:34:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521398#M48602</guid>
      <dc:creator>NhuMai</dc:creator>
      <dc:date>2021-12-12T16:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Set infoWindow title with html element</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521399#M48603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I have never attempted what you are trying but you should try and use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jsapi/infowindowbase-amd.html#startupdijits" title="https://developers.arcgis.com/javascript/3/jsapi/infowindowbase-amd.html#startupdijits"&gt;InfoWindowBase | API Reference | ArcGIS API for JavaScript 3.19 | startupDijits&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2016 22:02:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521399#M48603</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-12-21T22:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set infoWindow title with html element</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521400#M48604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the tip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After adding the InfoWindowBase requirement, I tried the following:&lt;/P&gt;&lt;P&gt;template.startupDijits(identifySelect)&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;template.startupDijits()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gives me:&lt;/P&gt;&lt;P&gt;template.startupDijits is not a function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Going to keep searching, but just wanted to keep you posted and see if you had feedback.&lt;/P&gt;&lt;P&gt;Mahalo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2016 01:50:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521400#M48604</guid>
      <dc:creator>NhuMai</dc:creator>
      <dc:date>2016-12-22T01:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set infoWindow title with html element</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521401#M48605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the template objects class type?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2016 14:38:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/set-infowindow-title-with-html-element/m-p/521401#M48605</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-12-22T14:38:14Z</dc:date>
    </item>
  </channel>
</rss>

