<?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 Refresh labels in layer list widget programmatically in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/refresh-labels-in-layer-list-widget/m-p/1102117#M21378</link>
    <description>&lt;P&gt;Web AppBuilder 2.21 Developer Edition&lt;/P&gt;&lt;P&gt;I'm trying to refresh the labels for a specific layer in the layer list widget.&amp;nbsp; The new labels are dependent of the map view and are recreated at every update-end event for the respective layer.&lt;/P&gt;&lt;P&gt;I can refresh the labels in the layer list widget using the _refresh() method but it collapses the legend for the layer.&amp;nbsp; How can I expand the legend after the _refresh()?&lt;/P&gt;&lt;P&gt;Or, if anyone has a better solution, I'm all ears.&amp;nbsp; Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Sep 2021 14:18:34 GMT</pubDate>
    <dc:creator>Danik-B</dc:creator>
    <dc:date>2021-09-27T14:18:34Z</dc:date>
    <item>
      <title>Refresh labels in layer list widget programmatically</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/refresh-labels-in-layer-list-widget/m-p/1102117#M21378</link>
      <description>&lt;P&gt;Web AppBuilder 2.21 Developer Edition&lt;/P&gt;&lt;P&gt;I'm trying to refresh the labels for a specific layer in the layer list widget.&amp;nbsp; The new labels are dependent of the map view and are recreated at every update-end event for the respective layer.&lt;/P&gt;&lt;P&gt;I can refresh the labels in the layer list widget using the _refresh() method but it collapses the legend for the layer.&amp;nbsp; How can I expand the legend after the _refresh()?&lt;/P&gt;&lt;P&gt;Or, if anyone has a better solution, I'm all ears.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 14:18:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/refresh-labels-in-layer-list-widget/m-p/1102117#M21378</guid>
      <dc:creator>Danik-B</dc:creator>
      <dc:date>2021-09-27T14:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh labels in layer list widget programmatically</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/refresh-labels-in-layer-list-widget/m-p/1102207#M21380</link>
      <description>&lt;P&gt;Through some trialing I was able to come up with a solution.&amp;nbsp; Not sure if this is best practice but it does seem to work.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function updateLayerListLegend(featureLayer){
    //Using the Widget Manager get an instance of the Layer List widget
    let wm = WidgetManager.getInstance(),
        layerListWidget = wm.getWidgetsByName('LayerList')[0];
    if(layerListWidget){
        //Get the layer info for the layer who's legend is to be updated
        let layerInfo = layerListWidget.operLayerInfos.getLayerInfoById(featureLayer.id)
        //Use the redrawLegends method to update the legend.  Parameter must be a layer info, not the feature layer.
        layerListWidget.layerListView.redrawLegends(layerInfo)
    }
}&lt;/LI-CODE&gt;&lt;P&gt;I couldn't find any documentation on this, so be forewarned. It may not work in other versions.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 17:04:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/refresh-labels-in-layer-list-widget/m-p/1102207#M21380</guid>
      <dc:creator>Danik-B</dc:creator>
      <dc:date>2021-09-27T17:04:24Z</dc:date>
    </item>
  </channel>
</rss>

