<?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 Dropdown option to sidebar div in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-option-to-sidebar-div/m-p/1330396#M82253</link>
    <description>&lt;P&gt;The app I'm working on is basically a conglomeration of some of the samples. It works fine as is. In it, if you click on a point in the map you will see the text from the feature's Description field update in the sidebar. I want the same thing to happen when you click an option in the "Search by Category" drop-down.&lt;/P&gt;&lt;P&gt;Working app is &lt;A href="https://webapp.willcountyillinois.com/willcountygreen/" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've been working in the section of code that puts the pop-up result in the sidebar. I can't find a reproducible sample for what I want to do.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//Popup in sidebar
    view.when().then(function () {
        // Create a default graphic for when the application starts
        const graphic = {
            popupTemplate: {
                content: "To search by item make sure Search by Category is set to 'Select one'.&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;Businesses should note that they will find more appropriate listings if they check Business under the search box. Hit Search after changing from Residential to Business or vice versa."
            },
        };
        // Provide a graphic to a new instance of a Feature widget
        const feature = new Feature({
            container: "sidebar",
            graphic: graphic,
            map: view.map,
            spatialReference: view.spatialReference
        });

        // description variable
        var sidebardescription = {
            //autocasts the new template
            content: [
                {
                    //set a descriptive text element
                    type: "text", // TextContentElement
                    text: "{Description}"
                },
            ]
        };

        view.whenLayerView(recycleLayer).then(function (layerView) {
            let highlight;
            // listen for the pointer-move event on the View
            view.on("click", function (event) {
                // Perform a hitTest on the View
                view.hitTest(event).then(function (event) {
                    // Make sure graphic has a popupTemplate
                    let results = event.results.filter(function (result) {
                        return result.graphic.layer.popupTemplate;
                    });
                    let result = results[0];
                    highlight &amp;amp;&amp;amp; highlight.remove();

                    // On pointer-click, update the graphic of the Feature widget
                    // with the result
                    if (result) {
                        feature.graphic = result.graphic.clone(); //clone it to avoid mutation
                        feature.graphic.popupTemplate = sidebardescription;
                        highlight = layerView.highlight(result.graphic);
                    } else {
                        feature.graphic = graphic;
                    }
                });
                console.info("popup chosen")
            });
        });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 20:46:49 GMT</pubDate>
    <dc:creator>JaredPilbeam2</dc:creator>
    <dc:date>2023-09-19T20:46:49Z</dc:date>
    <item>
      <title>Dropdown option to sidebar div</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-option-to-sidebar-div/m-p/1330396#M82253</link>
      <description>&lt;P&gt;The app I'm working on is basically a conglomeration of some of the samples. It works fine as is. In it, if you click on a point in the map you will see the text from the feature's Description field update in the sidebar. I want the same thing to happen when you click an option in the "Search by Category" drop-down.&lt;/P&gt;&lt;P&gt;Working app is &lt;A href="https://webapp.willcountyillinois.com/willcountygreen/" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've been working in the section of code that puts the pop-up result in the sidebar. I can't find a reproducible sample for what I want to do.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//Popup in sidebar
    view.when().then(function () {
        // Create a default graphic for when the application starts
        const graphic = {
            popupTemplate: {
                content: "To search by item make sure Search by Category is set to 'Select one'.&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;Businesses should note that they will find more appropriate listings if they check Business under the search box. Hit Search after changing from Residential to Business or vice versa."
            },
        };
        // Provide a graphic to a new instance of a Feature widget
        const feature = new Feature({
            container: "sidebar",
            graphic: graphic,
            map: view.map,
            spatialReference: view.spatialReference
        });

        // description variable
        var sidebardescription = {
            //autocasts the new template
            content: [
                {
                    //set a descriptive text element
                    type: "text", // TextContentElement
                    text: "{Description}"
                },
            ]
        };

        view.whenLayerView(recycleLayer).then(function (layerView) {
            let highlight;
            // listen for the pointer-move event on the View
            view.on("click", function (event) {
                // Perform a hitTest on the View
                view.hitTest(event).then(function (event) {
                    // Make sure graphic has a popupTemplate
                    let results = event.results.filter(function (result) {
                        return result.graphic.layer.popupTemplate;
                    });
                    let result = results[0];
                    highlight &amp;amp;&amp;amp; highlight.remove();

                    // On pointer-click, update the graphic of the Feature widget
                    // with the result
                    if (result) {
                        feature.graphic = result.graphic.clone(); //clone it to avoid mutation
                        feature.graphic.popupTemplate = sidebardescription;
                        highlight = layerView.highlight(result.graphic);
                    } else {
                        feature.graphic = graphic;
                    }
                });
                console.info("popup chosen")
            });
        });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 20:46:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-option-to-sidebar-div/m-p/1330396#M82253</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2023-09-19T20:46:49Z</dc:date>
    </item>
  </channel>
</rss>

