<?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 selection symbology click from custom widget in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165591#M14722</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;&amp;nbsp;You should try using&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.layerObject.setSelectionSymbol(symbolJsonUtils.fromJson(this.config.selectionSymbol));&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 19 Apr 2022 12:25:22 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2022-04-19T12:25:22Z</dc:date>
    <item>
      <title>Set selection symbology click from custom widget</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165375#M14721</link>
      <description>&lt;P&gt;I'm trying to perform a selection from an attribute query, center the map and apply a symbol to the selection.&amp;nbsp; I know I'm selecting the correct point feature, the map centers on it, but I'm not sure how to change the symbol of that selected feature.&lt;/P&gt;&lt;P&gt;I'm applying the query on a feature layer in the source webmap.&lt;/P&gt;&lt;P&gt;e.target.id is just sending the value for the where of the query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        reply_click: function (e) {
            
            console.log(e.target.id)
            this.map.itemInfo.itemData.operationalLayers.forEach(layer =&amp;gt; {
                if (layer.layerObject) {
                    if (layer.title === "Water Use Application Facilities") {                        
                        var queryTask = new QueryTask(layer.layerObject)
                        var query = new Query();
                        query.returnGeometry = true;
                        query.outFields = ['*']
                        query.where = "facilityId = '" + e.target.id + "'"
                                           
                        layer.layerObject.setSelectionSymbol(new SimpleMarkerSymbol(this.config.selectionSymbol));
                        layer.layerObject.selectFeatures(query).then(function (features) {
                            if (layer.layerObject.geometryType === 'esriGeometryPoint' &amp;amp;&amp;amp; features.length === 1) {
                                this.map.centerAt(features[0].geometry); //correctly centers
                                
                            }
                        });
                    }
                }
            })
        },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;symbology is defined in the config.json file of the widget:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"selectionSymbol": {
		"color": [
			0,
			0,
			0,
			0
		],
		"size": 20.5,
		"angle": 0,
		"xoffset": 0,
		"yoffset": 0,
		"type": "esriSMS",
		"style": "esriSMSCircle",
		"outline": {
			"color": [
				0,
				255,
				250,
				255
			],
			"width": 1.50,
			"type": "esriSLS",
			"style": "esriSLSSolid"
		}
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 19:55:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165375#M14721</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-04-18T19:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Set selection symbology click from custom widget</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165591#M14722</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;&amp;nbsp;You should try using&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.layerObject.setSelectionSymbol(symbolJsonUtils.fromJson(this.config.selectionSymbol));&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Apr 2022 12:25:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165591#M14722</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2022-04-19T12:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Set selection symbology click from custom widget</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165652#M14723</link>
      <description>&lt;P&gt;Hi Robert -- thanks for the reply.&lt;/P&gt;&lt;P&gt;I still don't see any change in symbol on the selected feature.&amp;nbsp; In an attempt to simplify, I just added the SimpleMarkerSymbol reference directly in the code to see if that would work but still not getting the symbology to change.&lt;/P&gt;&lt;P&gt;I thought perhaps a layer.refresh() was needed but it has no affect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var selSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10,
                new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
                    new Color([255, 0, 0]), 1),
                new Color([0, 255, 0, 0.25]));
            
            console.log(e.target.id)
            this.map.itemInfo.itemData.operationalLayers.forEach(layer =&amp;gt; {
                if (layer.layerObject) {
                    if (layer.title === "Water Use Application Facilities") {                        
                        var queryTask = new QueryTask(layer.layerObject)
                        var query = new Query();
                        query.returnGeometry = true;
                        query.outFields = ['*']
                        query.where = "facilityId = '" + e.target.id + "'"
                                           
                        //layer.layerObject.setSelectionSymbol(new SimpleMarkerSymbol(this.config.selectionSymbol));
                        var selSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1),new Color([0, 255, 0, 0.25]));
                        layer.layerObject.setSelectionSymbol(selSymbol);
                        layer.layerObject.selectFeatures(query).then(function (features) {
                            if (layer.layerObject.geometryType === 'esriGeometryPoint' &amp;amp;&amp;amp; features.length === 1) {
                                this.map.centerAt(features[0].geometry);
                                //layer.layerObject.setSelectionSymbol(symbolJsonUtils.fromJson(selSymbol));
                                layer.layerObject.setSelectionSymbol(selSymbol);
                                layer.layerObject.refresh();
                            }
                        });
                    }
                }
            })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just for reference, query.where is getting built with the e.target.id and seems to work fine because the map.centerAt() functions correctly when I click the specific item on the widget (e.target.id is the facilityId property found on the grid within the widget).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JamesCrandall_0-1650378441989.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39306i8DE7754AE2B320DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JamesCrandall_0-1650378441989.png" alt="JamesCrandall_0-1650378441989.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 14:29:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165652#M14723</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-04-19T14:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Set selection symbology click from custom widget</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165681#M14724</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;&amp;nbsp;Personally I do not use a FeatureLayer's selectFeatures method. I always just add a GraphicsLayer to the Map with the results of the query. The GL is overlayed on the FeatureLayer and easy to define the symbology you want.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 15:18:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165681#M14724</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2022-04-19T15:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set selection symbology click from custom widget</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165712#M14725</link>
      <description>&lt;P&gt;Was tired of banging my head against the wall on that setSelectionsSysmbol and just implemented a simply selection Graphic that is added to the map.&amp;nbsp; I supposed if I have other graphics to deal with then the wholesale map.graphics.clear() that I do prior to each call would need to change but for now this will work I think.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 15:23:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165712#M14725</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-04-19T15:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set selection symbology click from custom widget</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165752#M14726</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;&amp;nbsp;I also normally add a query specific GraphicsLayer to the map that way clearing the map.graphics does not affect the query that I am working with.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 16:51:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/set-selection-symbology-click-from-custom-widget/m-p/1165752#M14726</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2022-04-19T16:51:30Z</dc:date>
    </item>
  </channel>
</rss>

