<?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: How do show updated layer renderer in map? (WAB-DE/JSAPI 3.x) in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-do-show-updated-layer-renderer-in-map-wab-de/m-p/1153151#M21986</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/237415"&gt;@Arne_Gelfert&lt;/a&gt;&amp;nbsp;do you have a widget with the full code that you wouldn't mind sharing? I am trying to do something similar to you but having lots of trouble.&lt;/P&gt;</description>
    <pubDate>Sat, 12 Mar 2022 01:51:26 GMT</pubDate>
    <dc:creator>KisakyeM</dc:creator>
    <dc:date>2022-03-12T01:51:26Z</dc:date>
    <item>
      <title>How do show updated layer renderer in map? (WAB-DE/JSAPI 3.x)</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-do-show-updated-layer-renderer-in-map-wab-de/m-p/1067504#M20958</link>
      <description>&lt;P&gt;Likely this is explained somewhere but I can't find it and nothing I've tried seems to work.&amp;nbsp;Working in WAB DE 2.16 with corresponding JSAPI 3.x. The back and forth between the JSAPI documentation and the cryptic jimu pages is killing me.&lt;/P&gt;&lt;P&gt;I have a dojo dropdown that allows me to set a filter expression for a particular layer. Depending on the value selected from the dropdown, only features with attribute A matching the dropdown value are shown in the map. Simple enough, right?&lt;/P&gt;&lt;P&gt;Now I would also like to color those features based on Attribute B as part of the same dropdown event handler. Value1 = 'red', value2 = 'blue', value3 = 'green'... something like that.&lt;/P&gt;&lt;P&gt;I have created a renderer that dynamically creates a list of colors depending on the list of values for Attribute and I seem to be updating the layers renderer. But the change is never reflected in the map.&lt;/P&gt;&lt;P&gt;I am doing something like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var nodeId = 'my_id'
var layerStructure = LayerStructure.getInstance();
var myLayer = layerStructure.getNodeById(nodeId);
myLayer.renderer = uniqueValueRenderer;&lt;/LI-CODE&gt;&lt;P&gt;I can see in Dev Tools myLayer now has this renderer with the correct number of values. But the map does not update.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;myLayer.refresh()&lt;/LI-CODE&gt;&lt;P&gt;doesn't work. It says:&lt;/P&gt;&lt;P&gt;Not entirely sure what the difference is between the layerNode and layerNode.getLayerObject() but when I try this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;myLayer.getLayerObject().then(function(result) {
   result.renderer = uniqueValueRenderer;
   console.log(result);
   result.refresh();
});&lt;/LI-CODE&gt;&lt;P&gt;there is no error and I also see the renderer when I look at 'result'. But again, the map doesn't update.&lt;/P&gt;&lt;P&gt;And how about &lt;A href="https://developers.arcgis.com/web-appbuilder/api-reference/rendererchooser.htm" target="_self"&gt;RendererChooser&lt;/A&gt;? Where does that come in? I've looked with no luck for an example of how that's supposed to be used but I can't find one. Is this a features vs. graphics issue? Am I not seeing the trees for the forest?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 19:26:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-do-show-updated-layer-renderer-in-map-wab-de/m-p/1067504#M20958</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2021-06-11T19:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do show updated layer renderer in map? (WAB-DE/JSAPI 3.x)</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-do-show-updated-layer-renderer-in-map-wab-de/m-p/1071521#M21017</link>
      <description>&lt;P&gt;So turns out that the issue was not with refresh() or with creating the uniqueValueRenderer() but I was doing this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// inside foreach loop over mycolors list
uniqueValueRenderer.addValue(attr, new SimpleMarkerSymbol().setColor(new Color(mycolor)));&lt;/LI-CODE&gt;&lt;P&gt;when I should have been doing this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// inside foreach loop over mycolors list
let rendSymbol = new SimpleFillSymbol();
rendSymbol.setColor(new Color(mycolor));
uniqueValueRenderer.addValue(attr, rendSymbol);&lt;/LI-CODE&gt;&lt;P&gt;Not entirely sure why the latter but the former fails. But I got it working. Now depending on your choice of attribute, we can dynamically create a palette of colors and symbolize map features with the palette.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:25:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-do-show-updated-layer-renderer-in-map-wab-de/m-p/1071521#M21017</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2021-06-23T15:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do show updated layer renderer in map? (WAB-DE/JSAPI 3.x)</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-do-show-updated-layer-renderer-in-map-wab-de/m-p/1153151#M21986</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/237415"&gt;@Arne_Gelfert&lt;/a&gt;&amp;nbsp;do you have a widget with the full code that you wouldn't mind sharing? I am trying to do something similar to you but having lots of trouble.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2022 01:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-do-show-updated-layer-renderer-in-map-wab-de/m-p/1153151#M21986</guid>
      <dc:creator>KisakyeM</dc:creator>
      <dc:date>2022-03-12T01:51:26Z</dc:date>
    </item>
  </channel>
</rss>

