<?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 How to get the LayerView style in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-the-layerview-style/m-p/587779#M54901</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a SketchViewModel for a graphics layer. When I add the &lt;SPAN&gt;layerView&amp;nbsp;to it&lt;/SPAN&gt;&amp;nbsp;I need to change some styling at runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// create a featureLayer&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;const featureLayer = new FeatureLayer({&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;url: myurl&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;map.add(featureLayer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// create a mapview and&amp;nbsp;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;var view = new MapView({&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/&amp;nbsp;/ other stuff here&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Given this basic &lt;SPAN&gt;featureLayer example&lt;/SPAN&gt;, I will wait for the &lt;SPAN&gt;layerView&amp;nbsp;&lt;/SPAN&gt;to be ready.&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;view.whenLayerView(featureLayer).then(function(layerView) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="font-family: 'andale mono', monospace; color: #ff0000;"&gt;How would you go about accessing and changing the style for a LayerView without&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace; color: #ff0000;"&gt;&amp;nbsp; &amp;nbsp;sifting through all the layers as in the example below?&lt;/SPAN&gt;&lt;BR /&gt; });&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a shorter way to get to the layerview style?&lt;/P&gt;&lt;P&gt;// this is just an example of what I do not want to do&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;var maplayers = item.layer.parent.allLayers.filter(function (a) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;return a.title === "my layer";&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;var style&amp;nbsp; = maplayers.items[0].sublayers.items.filter(function (a) {&lt;/P&gt;&lt;P&gt;// do my runtime styling work here&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Oct 2020 22:13:37 GMT</pubDate>
    <dc:creator>GregoryBologna</dc:creator>
    <dc:date>2020-10-08T22:13:37Z</dc:date>
    <item>
      <title>How to get the LayerView style</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-the-layerview-style/m-p/587779#M54901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a SketchViewModel for a graphics layer. When I add the &lt;SPAN&gt;layerView&amp;nbsp;to it&lt;/SPAN&gt;&amp;nbsp;I need to change some styling at runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// create a featureLayer&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;const featureLayer = new FeatureLayer({&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;url: myurl&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;map.add(featureLayer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// create a mapview and&amp;nbsp;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;var view = new MapView({&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/&amp;nbsp;/ other stuff here&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Given this basic &lt;SPAN&gt;featureLayer example&lt;/SPAN&gt;, I will wait for the &lt;SPAN&gt;layerView&amp;nbsp;&lt;/SPAN&gt;to be ready.&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;view.whenLayerView(featureLayer).then(function(layerView) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="font-family: 'andale mono', monospace; color: #ff0000;"&gt;How would you go about accessing and changing the style for a LayerView without&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace; color: #ff0000;"&gt;&amp;nbsp; &amp;nbsp;sifting through all the layers as in the example below?&lt;/SPAN&gt;&lt;BR /&gt; });&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a shorter way to get to the layerview style?&lt;/P&gt;&lt;P&gt;// this is just an example of what I do not want to do&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;var maplayers = item.layer.parent.allLayers.filter(function (a) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;return a.title === "my layer";&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;var style&amp;nbsp; = maplayers.items[0].sublayers.items.filter(function (a) {&lt;/P&gt;&lt;P&gt;// do my runtime styling work here&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2020 22:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-the-layerview-style/m-p/587779#M54901</guid>
      <dc:creator>GregoryBologna</dc:creator>
      <dc:date>2020-10-08T22:13:37Z</dc:date>
    </item>
  </channel>
</rss>

