<?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 WAB - update NearMe widget configuration programmaticlly in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-update-nearme-widget-configuration/m-p/1218620#M22542</link>
    <description>&lt;P&gt;Web AppBuilder 2.21 Developer Edition&lt;/P&gt;&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I'm trying to change the configuration of the NearMe widget. I've generated both of the config files from WAB. I tested the widget with each file and is working fine. Now, I did'nt want to duplicate the widget and I would like to alternate bitween the two configurations. I've added two radio buttons to handle the user action.&lt;/P&gt;&lt;P&gt;Here a snnipt of my code&lt;/P&gt;&lt;P&gt;function changeConfig(PanelManager, WidgetManager) {&lt;BR /&gt;let mywidget = PanelManager.getInstance().widgetManager.loaded.filter((item) =&amp;gt; {return item.name == 'NearMe'});&lt;BR /&gt;const button1 = document.getElementById('button1')&lt;BR /&gt;const button2 = document.getElementById('button2')&lt;BR /&gt;button1 &amp;amp;&amp;amp; button1.checked ? mywidget[0].config = config1 : null;&lt;BR /&gt;button2 &amp;amp;&amp;amp; button2.checked ? mywidget[0].config = config2 : null;&lt;BR /&gt;console.log(mywidget[0])&lt;BR /&gt;//destroy the widget with olde config&lt;BR /&gt;WidgetManager.getInstance().destroyWidget(mywidget[0])&lt;BR /&gt;//start the widget with the new config&lt;BR /&gt;mywidget[0].startup()&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any chance to do that ? I saw a related answer here &lt;A href="https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-modify-widget-config-programmatically/td-p/750964" target="_blank"&gt;https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-modify-widget-config-programmatically/td-p/750964&lt;/A&gt;&lt;BR /&gt;that would not possible but still trying to get that worked ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Oct 2022 14:18:11 GMT</pubDate>
    <dc:creator>GISiste</dc:creator>
    <dc:date>2022-10-04T14:18:11Z</dc:date>
    <item>
      <title>WAB - update NearMe widget configuration programmaticlly</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-update-nearme-widget-configuration/m-p/1218620#M22542</link>
      <description>&lt;P&gt;Web AppBuilder 2.21 Developer Edition&lt;/P&gt;&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I'm trying to change the configuration of the NearMe widget. I've generated both of the config files from WAB. I tested the widget with each file and is working fine. Now, I did'nt want to duplicate the widget and I would like to alternate bitween the two configurations. I've added two radio buttons to handle the user action.&lt;/P&gt;&lt;P&gt;Here a snnipt of my code&lt;/P&gt;&lt;P&gt;function changeConfig(PanelManager, WidgetManager) {&lt;BR /&gt;let mywidget = PanelManager.getInstance().widgetManager.loaded.filter((item) =&amp;gt; {return item.name == 'NearMe'});&lt;BR /&gt;const button1 = document.getElementById('button1')&lt;BR /&gt;const button2 = document.getElementById('button2')&lt;BR /&gt;button1 &amp;amp;&amp;amp; button1.checked ? mywidget[0].config = config1 : null;&lt;BR /&gt;button2 &amp;amp;&amp;amp; button2.checked ? mywidget[0].config = config2 : null;&lt;BR /&gt;console.log(mywidget[0])&lt;BR /&gt;//destroy the widget with olde config&lt;BR /&gt;WidgetManager.getInstance().destroyWidget(mywidget[0])&lt;BR /&gt;//start the widget with the new config&lt;BR /&gt;mywidget[0].startup()&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any chance to do that ? I saw a related answer here &lt;A href="https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-modify-widget-config-programmatically/td-p/750964" target="_blank"&gt;https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-modify-widget-config-programmatically/td-p/750964&lt;/A&gt;&lt;BR /&gt;that would not possible but still trying to get that worked ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:18:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-update-nearme-widget-configuration/m-p/1218620#M22542</guid>
      <dc:creator>GISiste</dc:creator>
      <dc:date>2022-10-04T14:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: WAB - update NearMe widget configuration programmaticlly</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-update-nearme-widget-configuration/m-p/1245282#M22715</link>
      <description>&lt;P&gt;finnaly this code worked :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;function changeConfig(PanelManager, WidgetManager) {&lt;BR /&gt;let mywidget = PanelManager.getInstance().widgetManager.loaded.filter((item) =&amp;gt; {return item.name == 'NearMe'});&lt;BR /&gt;const button1 = document.getElementById('button1')&lt;BR /&gt;const button2 = document.getElementById('button2')&lt;BR /&gt;button1 &amp;amp;&amp;amp; button1.checked ? mywidget[0].config = config1 : null;&lt;BR /&gt;button2 &amp;amp;&amp;amp; button2.checked ? mywidget[0].config = config2 : null;&lt;BR /&gt;console.log(mywidget[0])&lt;BR /&gt;//destroy the widget with olde config&lt;BR /&gt;WidgetManager.getInstance().destroyWidget(mywidget[0])&lt;BR /&gt;//start the widget with the new config&lt;BR /&gt;mywidget[0].startup()&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 15:17:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-update-nearme-widget-configuration/m-p/1245282#M22715</guid>
      <dc:creator>GISiste</dc:creator>
      <dc:date>2023-01-04T15:17:24Z</dc:date>
    </item>
  </channel>
</rss>

