<?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: popupTemplate in Higher version(4.26) Arcgis api for js miss part of attributes like style or &amp;quot;onclick&amp;quot; event in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-in-higher-version-4-26-arcgis-api/m-p/1297689#M81328</link>
    <description>&lt;P&gt;See also &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-pop-up-onclick-is-not-rendering/m-p/1252930" target="_self"&gt;this thread&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 17:34:38 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2023-06-09T17:34:38Z</dc:date>
    <item>
      <title>popupTemplate in Higher version(4.26) Arcgis api for js miss part of attributes like style or "onclick" event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-in-higher-version-4-26-arcgis-api/m-p/1297452#M81321</link>
      <description>&lt;P&gt;Higher version(4.26) Arcgis api for js&amp;nbsp;miss part of attributes like style or "onclick" event.&lt;/P&gt;&lt;P&gt;There are two&amp;nbsp;identical file&lt;SPAN&gt;s&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;except for the version of Arcgis api for js，one is 4.26,the other is 4.10.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="微信图片_20230609101811.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72744iD05E8860907D44AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="微信图片_20230609101811.png" alt="微信图片_20230609101811.png" /&gt;&lt;/span&gt;Strangely, higher version file may lose some attributes.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="微信图片_20230609101948.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72746i431742FE670C6B6D/image-size/large?v=v2&amp;amp;px=999" role="button" title="微信图片_20230609101948.png" alt="微信图片_20230609101948.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="微信图片_20230609102017.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72745iA595DE75FCED9B60/image-size/large?v=v2&amp;amp;px=999" role="button" title="微信图片_20230609102017.png" alt="微信图片_20230609102017.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Has anyone encountered this situation or known the reasons and solutions？&lt;/P&gt;&lt;P&gt;Here is the code and change the version4.10 to 4.26 to get two files:&lt;/P&gt;&lt;P&gt;&amp;lt;html lang="en"&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;meta charset="utf-8" /&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport"&lt;BR /&gt;content="initial-scale=1,maximum-scale=1,user-scalable=no" /&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;&lt;BR /&gt;Intro to PopupTemplate | Sample | ArcGIS Maps SDK for JavaScript 4.10&lt;BR /&gt;&amp;lt;/title&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;html,&lt;BR /&gt;body,&lt;BR /&gt;#viewDiv {&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;height: 100%;&lt;BR /&gt;width: 100%;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;link rel="stylesheet"&lt;BR /&gt;href="&lt;A href="https://js.arcgis.com/4.10/esri/themes/light/main.css" target="_blank"&gt;https://js.arcgis.com/4.10/esri/themes/light/main.css&lt;/A&gt;" /&amp;gt;&lt;BR /&gt;&amp;lt;script src="&lt;A href="https://js.arcgis.com/4.10/" target="_blank"&gt;https://js.arcgis.com/4.10/&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;require([&lt;BR /&gt;"esri/Map",&lt;BR /&gt;"esri/layers/FeatureLayer",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/widgets/Legend"&lt;BR /&gt;], (Map, FeatureLayer, MapView, Legend) =&amp;gt; {&lt;BR /&gt;// Create the map&lt;BR /&gt;const map = new Map({&lt;BR /&gt;basemap: "gray-vector"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Create the MapView&lt;BR /&gt;const view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map,&lt;BR /&gt;center: [-73.95, 40.702],&lt;BR /&gt;zoom: 10&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;view.ui.add(new Legend({ view: view }), "bottom-left");&lt;/P&gt;&lt;P&gt;/*************************************************************&lt;BR /&gt;* The PopupTemplate content is the text that appears inside the&lt;BR /&gt;* popup. {fieldName} can be used to reference the value of an&lt;BR /&gt;* attribute of the selected feature. HTML elements can be used&lt;BR /&gt;* to provide structure and styles within the content. The&lt;BR /&gt;* fieldInfos property is an array of objects (each object representing&lt;BR /&gt;* a field) that is use to format number fields and customize field&lt;BR /&gt;* aliases in the popup and legend.&lt;BR /&gt;**************************************************************/&lt;/P&gt;&lt;P&gt;//const template = {&lt;BR /&gt;// // autocasts as new PopupTemplate()&lt;BR /&gt;// title: "{NAME} in {COUNTY}",&lt;BR /&gt;// content: [&lt;BR /&gt;// {&lt;BR /&gt;// // It is also possible to set the fieldInfos outside of the content&lt;BR /&gt;// // directly in the popupTemplate. If no fieldInfos is specifically set&lt;BR /&gt;// // in the content, it defaults to whatever may be set within the popupTemplate.&lt;BR /&gt;// type: "fields",&lt;BR /&gt;// fieldInfos: [&lt;BR /&gt;// {&lt;BR /&gt;// fieldName: "B12001_calc_pctMarriedE",&lt;BR /&gt;// label: "Married %"&lt;BR /&gt;// },&lt;BR /&gt;// {&lt;BR /&gt;// fieldName: "B12001_calc_numMarriedE",&lt;BR /&gt;// label: "People Married",&lt;BR /&gt;// format: {&lt;BR /&gt;// digitSeparator: true,&lt;BR /&gt;// places: 0&lt;BR /&gt;// }&lt;BR /&gt;// },&lt;BR /&gt;// {&lt;BR /&gt;// fieldName: "B12001_calc_numNeverE",&lt;BR /&gt;// label: "People that Never Married",&lt;BR /&gt;// format: {&lt;BR /&gt;// digitSeparator: true,&lt;BR /&gt;// places: 0&lt;BR /&gt;// }&lt;BR /&gt;// },&lt;BR /&gt;// {&lt;BR /&gt;// fieldName: "B12001_calc_numDivorcedE",&lt;BR /&gt;// label: "People Divorced",&lt;BR /&gt;// format: {&lt;BR /&gt;// digitSeparator: true,&lt;BR /&gt;// places: 0&lt;BR /&gt;// }&lt;BR /&gt;// }&lt;BR /&gt;// ]&lt;BR /&gt;// }&lt;BR /&gt;// ]&lt;BR /&gt;//};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;const template = {&lt;BR /&gt;// autocasts as new PopupTemplate()&lt;BR /&gt;title: "{NAME} in {COUNTY}",&lt;BR /&gt;content: '&amp;lt;table class="table"&amp;gt;'&lt;BR /&gt;+ '&amp;lt;tbody&amp;gt;'&lt;BR /&gt;+ '&amp;lt;tr&amp;gt;&amp;lt;td style="width:30%;"&amp;gt;NAME:&amp;lt;/td&amp;gt;&amp;lt;td style="text-align:left;"&amp;gt;{NAME}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;'&lt;BR /&gt;+ '&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;COUNTY:&amp;lt;/td&amp;gt;&amp;lt;td style="text-align:left;"&amp;gt;{COUNTY}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;'&lt;BR /&gt;+ '&amp;lt;tr&amp;gt; &amp;lt;td style="text-align:center;" colspan="2"&amp;gt;&amp;lt;a style="cursor: pointer;background-color:black;" onclick="alert(\'1\');"&amp;gt;aLable1&amp;lt;/a&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;a style="cursor: pointer;" onclick="alert(\'2\');"&amp;gt;aLable2&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr &amp;gt;'&lt;BR /&gt;+ '&amp;lt;/tbody&amp;gt;'&lt;BR /&gt;+ '&amp;lt;/table&amp;gt; '&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Reference the popupTemplate instance in the&lt;BR /&gt;// popupTemplate property of FeatureLayer&lt;BR /&gt;const featureLayer = new FeatureLayer({&lt;BR /&gt;url: "&lt;A href="https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/ACS_Marital_Status_Boundaries/FeatureServer/2" target="_blank"&gt;https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/ACS_Marital_Status_Boundaries/FeatureServer/2&lt;/A&gt;",&lt;BR /&gt;popupTemplate: template&lt;BR /&gt;});&lt;BR /&gt;map.add(featureLayer);&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 03:15:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-in-higher-version-4-26-arcgis-api/m-p/1297452#M81321</guid>
      <dc:creator>jerry_liuyu</dc:creator>
      <dc:date>2023-06-09T03:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: popupTemplate in Higher version(4.26) Arcgis api for js miss part of attributes like style or "onclick" event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-in-higher-version-4-26-arcgis-api/m-p/1297662#M81327</link>
      <description>&lt;P&gt;Adding some HTML tags directly in the content will be sanitized, like links or click events. You can work around this in your app a couple of ways, like returning a function in the content or using CustomContent.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/using-html-with-popups-in-the-arcgis-api-for-javascript/" target="_blank" rel="noopener"&gt;https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/using-html-with-popups-in-the-arcgis-api-for-javascript/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/popup-customcontent/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/popup-customcontent/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://odoe.net/blog/custom-popup-content" target="_blank"&gt;https://odoe.net/blog/custom-popup-content&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:58:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-in-higher-version-4-26-arcgis-api/m-p/1297662#M81327</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-06-09T16:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: popupTemplate in Higher version(4.26) Arcgis api for js miss part of attributes like style or "onclick" event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-in-higher-version-4-26-arcgis-api/m-p/1297689#M81328</link>
      <description>&lt;P&gt;See also &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-pop-up-onclick-is-not-rendering/m-p/1252930" target="_self"&gt;this thread&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:34:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-in-higher-version-4-26-arcgis-api/m-p/1297689#M81328</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-06-09T17:34:38Z</dc:date>
    </item>
  </channel>
</rss>

