<?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: Representing an array in a popup in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/representing-an-array-in-a-popup/m-p/1484459#M84790</link>
    <description>&lt;P&gt;This is going to require using &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-CustomContent.html" target="_blank" rel="noopener"&gt;CustomContent&lt;/A&gt; and writing your own UI to display that info. The creator event will give you the graphic and you can return some custom HTML in the function to display your results. I had shown something similar &lt;A href="https://odoe.net/blog/custom-popup-content" target="_blank" rel="noopener"&gt;here&lt;/A&gt; for weather data.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2024 15:28:14 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2024-06-04T15:28:14Z</dc:date>
    <item>
      <title>Representing an array in a popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/representing-an-array-in-a-popup/m-p/1484415#M84789</link>
      <description>&lt;P&gt;I have a use case where a graphic can contain data relating to other graphics that have been "merged". The data is stored in an attribute property called `innterGraphics` that contain an array of graphic attributes objects (example below).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I want to display the `innerGraphics` in a popup but I'm not seeing a native method for representing arrays in a popup. Is there something I'm missing?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "aggregateGeometries": null,
    "geometry": {
        "spatialReference": {
            "wkid": 4326
        },
        "x": -72.93538699999993,
        "y": 41.332516000000055
    },
    "symbol": null,
    "attributes": {
        "crashId": 1,
        "symbolType": "Sideswipe, Same Direction",
        "groupId": 25,
        "direction": null,
        "date": null,
        "innerGraphics": [
            {
                "crashId": 222,
                "symbolType": "Sideswipe, Same Direction",
                "groupId": 20,
                "direction": 0,
                "date": 1682173620000,
                "severity": "O",
                "narrative": ""
            },
            {
                "crashId": 333,
                "symbolType": "Front to Rear",
                "groupId": 14,
                "direction": 0,
                "date": 1674143040000,
                "severity": "O",
                "narrative": ""
            },
            {
                "crashId": 111,
                "symbolType": "Front to Rear",
                "groupId": 22,
                "direction": 0,
                "date": 1697535840000,
                "severity": "O",
                "narrative": "Narrative unavailable for this crash."
            }
        ]
    },
    "popupTemplate": null
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 14:58:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/representing-an-array-in-a-popup/m-p/1484415#M84789</guid>
      <dc:creator>JMMFIRE</dc:creator>
      <dc:date>2024-06-04T14:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Representing an array in a popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/representing-an-array-in-a-popup/m-p/1484459#M84790</link>
      <description>&lt;P&gt;This is going to require using &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-CustomContent.html" target="_blank" rel="noopener"&gt;CustomContent&lt;/A&gt; and writing your own UI to display that info. The creator event will give you the graphic and you can return some custom HTML in the function to display your results. I had shown something similar &lt;A href="https://odoe.net/blog/custom-popup-content" target="_blank" rel="noopener"&gt;here&lt;/A&gt; for weather data.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 15:28:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/representing-an-array-in-a-popup/m-p/1484459#M84790</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2024-06-04T15:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Representing an array in a popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/representing-an-array-in-a-popup/m-p/1484744#M84797</link>
      <description>&lt;P&gt;So I had some time and a crazy idea.&lt;/P&gt;&lt;P&gt;You could return a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Features.html" target="_blank" rel="noopener"&gt;Features widget&lt;/A&gt; in the CustomContent of your popup and turn your innerGraphics into pseudo graphics the Features widget could use. It requires some set up, but it works.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/xxNdQMQ?editors=0010" target="_blank"&gt;https://codepen.io/odoe/pen/xxNdQMQ?editors=0010&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const fieldContent = new FieldsContent({
	outFields: ["*"],
	fieldInfos: [
		{
			fieldName: "crashId",
			label: "Crash ID"
		},
		{
			fieldName: "groupId",
			label: "Group ID"
		}
	]
});

const customContentWidget = new CustomContent({
	outFields: ["*"],
	creator: ({ graphic }) =&amp;gt; {
		const { innerGraphics } = graphic.attributes;
		const graphics = innerGraphics.map((attributes) =&amp;gt; {
			return new Graphic({
				geometry: null,
				attributes,
				popupTemplate: {
					title: "Inner Crash ID: {crashId}",
					content: [
						{
							type: "fields",
							outFields: ["*"],
							fieldInfos: [
								{
									fieldName: "crashId",
									label: "Inner Crash ID"
								},
								{
									fieldName: "groupId",
									label: "Inner Group ID"
								},
								{
									fieldName: "symbolType",
									label: "Symbol"
								},
								{
									fieldName: "direction",
									label: "Direction"
								},
								{
									fieldName: "severity",
									label: "Severity"
								},
								{
									fieldName: "narrative",
									label: "Narrative"
								}
							]
						}
					]
				}
			});
		});

		console.log(graphics);

		const features = new Features({
			features: graphics,
			visible: true,
			visibleElements: {
				actionBar: false,
				closeButton: false,
				collapseButton: false,
			}
		});

		return features;
	}
});

const graphicObj = {
	geometry: {
		spatialReference: {
			wkid: 4326
		},
		x: -72.93538699999993,
		y: 41.332516000000055,
		type: "point" // add geometry type
	},
	symbol: null,
	attributes: {
		crashId: 1,
		symbolType: "Sideswipe, Same Direction",
		groupId: 25,
		direction: null,
		date: null,
		innerGraphics: [
			{
				crashId: 222,
				symbolType: "Sideswipe, Same Direction",
				groupId: 20,
				direction: 0,
				date: 1682173620000,
				severity: "O",
				narrative: ""
			},
			{
				crashId: 333,
				symbolType: "Front to Rear",
				groupId: 14,
				direction: 0,
				date: 1674143040000,
				severity: "O",
				narrative: ""
			},
			{
				crashId: 111,
				symbolType: "Front to Rear",
				groupId: 22,
				direction: 0,
				date: 1697535840000,
				severity: "O",
				narrative: "Narrative unavailable for this crash."
			}
		]
	},
	popupTemplate: {
		title: "Crash ID: {crashId}",
		outFields: ["*"],
		content: [fieldContent, customContentWidget]
	}
};

view.graphics.add(graphicObj);&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Jun 2024 20:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/representing-an-array-in-a-popup/m-p/1484744#M84797</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2024-06-04T20:15:45Z</dc:date>
    </item>
  </channel>
</rss>

